System.Data.Entity Namespace

Classes

CreateDatabaseIfNotExists<TContext>

An implementation of IDatabaseInitializer that will recreate and optionally re-seed the database only if the database does not exist. To seed the database, create a derived class and override the Seed method.

Database

An instance of this class is obtained from an DbContext object and can be used to manage the actual database backing a DbContext or connection. This includes creating, deleting, and checking for the existence of a database. Note that deletion and checking for existence of a database can be performed using just a connection (i.e. without a full context) by using the static methods of this class.

DbConfiguration

A class derived from this class can be placed in the same assembly as a class derived from DbContext to define Entity Framework configuration for an application. Configuration is set by calling protected methods and setting protected properties of this class in the constructor of your derived type. The type to use can also be registered in the config file of the application. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information about Entity Framework configuration.

DbConfigurationTypeAttribute

This attribute can be placed on a subclass of DbContext to indicate that the subclass of DbConfiguration representing the code-based configuration for the application is in a different assembly than the context type.

DbContext

A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that it can be used to query from a database and group together changes that will then be written back to the store as a unit. DbContext is conceptually similar to ObjectContext.

DbContextTransaction

Wraps access to the transaction object on the underlying store connection and ensures that the Entity Framework executes commands on the database within the context of that transaction. An instance of this class is retrieved by calling BeginTransaction() on the DbContextDatabase object.

DbExtensions
DbFunctionAttribute

Indicates that the given method is a proxy for an EDM function.

DbFunctions

Provides common language runtime (CLR) methods that expose EDM canonical functions for use in DbContext or ObjectContext LINQ to Entities queries.

DbModelBuilder

DbModelBuilder is used to map CLR classes to a database schema. This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'.

DbModelBuilderVersionAttribute

This attribute can be applied to a class derived from DbContext to set which version of the DbContext and DbModelBuilder conventions should be used when building a model from code--also known as "Code First". See the DbModelBuilderVersion enumeration for details about DbModelBuilder versions.

DbSet

A non-generic version of DbSet<TEntity> which can be used when the type of entity is not known at build time.

DbSet<TEntity>

A DbSet represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method.

DropCreateDatabaseAlways<TContext>

An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the database the first time that a context is used in the app domain. To seed the database, create a derived class and override the Seed method.

DropCreateDatabaseIfModelChanges<TContext>

An implementation of IDatabaseInitializer that will DELETE, recreate, and optionally re-seed the database only if the model has changed since the database was created.

MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>

An implementation of IDatabaseInitializer<TContext> that will use Code First Migrations to update the database to the latest version.

NullDatabaseInitializer<TContext>

An implementation of IDatabaseInitializer<TContext> that does nothing. Using this initializer disables database initialization for the given context type. Passing an instance of this class to SetInitializer<TContext>(IDatabaseInitializer<TContext>) is equivalent to passing null. When IDbDependencyResolver is being used to resolve initializers an instance of this class must be used to disable initialization.

ObservableCollectionExtensions

Extension methods for ObservableCollection<T>.

QueryableExtensions

Useful extension methods for use with Entity Framework LINQ queries.

Interfaces

IDatabaseInitializer<TContext>

An implementation of this interface is used to initialize the underlying database when an instance of a DbContext derived class is used for the first time. This initialization can conditionally create the database and/or seed it with data. The strategy used is set using the static InitializationStrategy property of the Database class. The following implementations are provided: DropCreateDatabaseIfModelChanges<TContext>, DropCreateDatabaseAlways<TContext>, CreateDatabaseIfNotExists<TContext>.

IDbSet<TEntity>

An IDbSet<TEntity> represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet<TEntity> is a concrete implementation of IDbSet.

Enums

DbModelBuilderVersion

A value from this enumeration can be provided directly to the DbModelBuilder class or can be used in the DbModelBuilderVersionAttribute applied to a class derived from DbContext. The value used defines which version of the DbContext and DbModelBuilder conventions should be used when building a model from code--also known as "Code First".

EntityState

Describes the state of an entity.

TransactionalBehavior

Controls the transaction creation behavior while executing a database command or query.