Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

System.Data.Entity Namespace

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

The System.Data.Entity namespace contains classes that provides access to the core functionality of the entity framework.

  ClassDescription
Public classCreateDatabaseIfNotExists<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.
Public classDatabaseAn instance of this class is obtained from a 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.
Public classDbConfigurationA 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.
Public classDbConfigurationTypeAttributeThis 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.
Public classDbContextA 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.
Public classDbContextTransactionWraps 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 DbContext and Database object.
Public classDbFunctionAttribute Indicates that the given method is a proxy for an EDM function.
Public classDbFunctionsProvides common language runtime (CLR) methods that expose EDM canonical functions for use in DbContext or ObjectContext LINQ to Entities queries.
Public classDbModelBuilderMaps CLR classes to a database schema. This code centric approach to building an Entity Data Model (EDM) model is known as 'Code First'.
Public classDbModelBuilderVersionAttribute 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.
Public classDbSetA non-generic version of DbSet<TEntity> which can be used when the type of entity is not known at build time.
Public classDbSet<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.
Public classDropCreateDatabaseAlways<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.
Public classDropCreateDatabaseIfModelChanges<TContext> An implementation of IDatabaseInitializer that will <b>DELETE</b>, recreate, and optionally re-seed the database only if the model has changed since the database was created.
Public classMigrateDatabaseToLatestVersion<TContext, TMigrationsConfiguration>Represents an implementation of IDatabaseInitializer<TContext> that will use Code First Migrations to update the database to the latest version.
Public classNullDatabaseInitializer<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.
Public classObservableCollectionExtensionsProvides extension method for the observable collection.
Public classQueryableExtensionsUseful extension methods for use with Entity Framework LINQ queries.
  InterfaceDescription
Public interfaceIDatabaseInitializer<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>.
Public interfaceIDbSet<TEntity> An IDbSet represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet is a concrete implementation of IDbSet.
  EnumerationDescription
Public enumerationDbModelBuilderVersion 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".
Public enumerationEntityState Describes the state of an entity.
Public enumerationTransactionalBehaviorControls the transaction creation behavior.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.