System.Data.Entity.Infrastructure Namespace

Classes

CommitFailedException

Thrown when an error occurs committing a DbTransaction.

CommitFailureHandler

A transaction handler that allows to gracefully recover from connection failures during transaction commit by storing transaction tracing information in the database. It needs to be registered by using SetDefaultTransactionHandler(Func<TransactionHandler>).

DbChangeTracker

Returned by the ChangeTracker method of DbContext to provide access to features of the context that are related to change tracking of entities.

DbCollectionEntry

A non-generic version of the DbCollectionEntry<TEntity,TElement> class.

DbCollectionEntry<TEntity,TElement>

Instances of this class are returned from the Collection method of DbEntityEntry<TEntity> and allow operations such as loading to be performed on the an entity's collection navigation properties.

DbCompiledModel

An immutable representation of an Entity Data Model (EDM) model that can be used to create an ObjectContext or can be passed to the constructor of a DbContext. For increased performance, instances of this type should be cached and re-used to construct contexts.

DbComplexPropertyEntry

A non-generic version of the DbComplexPropertyEntry<TEntity,TComplexProperty> class.

DbComplexPropertyEntry<TEntity,TComplexProperty>

Instances of this class are returned from the ComplexProperty method of DbEntityEntry<TEntity> and allow access to the state of a complex property.

DbConnectionInfo

Represents information about a database connection.

DbContextConfiguration

Returned by the Configuration method of DbContext to provide access to configuration options for the context.

DbContextInfo

Provides runtime information about a given DbContext type.

DbEntityEntry

A non-generic version of the DbEntityEntry<TEntity> class.

DbEntityEntry<TEntity>

Instances of this class provide access to information about and control of entities that are being tracked by the DbContext. Use the Entity or Entities methods of the context to obtain objects of this type.

DbExecutionStrategy

Provides the base implementation of the retry mechanism for unreliable operations and transient conditions that uses exponentially increasing delays between retries.

DbMemberEntry

This is an abstract base class use to represent a scalar or complex property, or a navigation property of an entity. Scalar and complex properties use the derived class DbPropertyEntry, reference navigation properties use the derived class DbReferenceEntry, and collection navigation properties use the derived class DbCollectionEntry.

DbMemberEntry<TEntity,TProperty>

This is an abstract base class use to represent a scalar or complex property, or a navigation property of an entity. Scalar and complex properties use the derived class DbPropertyEntry<TEntity,TProperty>, reference navigation properties use the derived class DbReferenceEntry<TEntity,TProperty>, and collection navigation properties use the derived class DbCollectionEntry<TEntity,TElement>.

DbModel

Represents an Entity Data Model (EDM) created by the DbModelBuilder. The Compile method can be used to go from this EDM representation to a DbCompiledModel which is a compiled snapshot of the model suitable for caching and creation of DbContext or ObjectContext instances.

DbModelStore

Base class for persisted model cache.

DbPropertyEntry

A non-generic version of the DbPropertyEntry<TEntity,TProperty> class.

DbPropertyEntry<TEntity,TProperty>

Instances of this class are returned from the Property method of DbEntityEntry<TEntity> and allow access to the state of the scalar or complex property.

DbPropertyValues

A collection of all the properties for an underlying entity or complex object.

DbProviderInfo

Groups a pair of strings that identify a provider and server version together into a single object.

DbQuery

Represents a non-generic LINQ to Entities query against a DbContext.

DbQuery<TResult>

Represents a LINQ to Entities query against a DbContext.

DbRawSqlQuery

Represents a SQL query for non-entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the Database instance. The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach. SQL queries for entities are created using SqlQuery(String, Object[]). See DbRawSqlQuery<TElement> for a generic version of this class.

DbRawSqlQuery<TElement>

Represents a SQL query for non-entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the Database instance. The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach. SQL queries for entities are created using SqlQuery(String, Object[]). See DbRawSqlQuery for a non-generic version of this class.

DbReferenceEntry

A non-generic version of the DbReferenceEntry<TEntity,TProperty> class.

DbReferenceEntry<TEntity,TProperty>

Instances of this class are returned from the Reference method of DbEntityEntry<TEntity> and allow operations such as loading to be performed on the an entity's reference navigation properties.

DbSqlQuery

Represents a SQL query for entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the DbSet instance for the entity type. The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach. SQL queries for non-entities are created using SqlQuery(Type, String, Object[]). See DbSqlQuery<TEntity> for a generic version of this class.

DbSqlQuery<TEntity>

Represents a SQL query for entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the DbSet<TEntity> instance for the entity type. The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach. SQL queries for non-entities are created using SqlQuery<TElement>(String, Object[]). See DbSqlQuery for a non-generic version of this class.

DbUpdateConcurrencyException

Exception thrown by DbContext when it was expected that SaveChanges for an entity would result in a database update but in fact no rows in the database were affected. This usually indicates that the database has been concurrently updated such that a concurrency token that was expected to match did not actually match. Note that state entries referenced by this exception are not serialized due to security and accesses to the state entries after serialization will return null.

DbUpdateException

Exception thrown by DbContext when the saving of changes to the database fails. Note that state entries referenced by this exception are not serialized due to security and accesses to the state entries after serialization will return null.

DefaultDbModelStore

Loads or saves models from/into .edmx files at a specified location.

DefaultExecutionStrategy

An IDbExecutionStrategy that doesn't retry operations if they fail.

DefaultManifestTokenResolver

A default implementation of IManifestTokenResolver that uses the underlying provider to get the manifest token. Note that to avoid multiple queries, this implementation using caching based on the actual type of DbConnection instance, the DataSource property, and the Database property.

EdmMetadata

Represents an entity used to store metadata about an EDM in the database.

EdmxReader

Utility class for reading a metadata model from .edmx.

EdmxWriter

Contains methods used to access the Entity Data Model created by Code First in the EDMX form. These methods are typically used for debugging when there is a need to look at the model that Code First creates internally.

ExecutionStrategyKey

A key used for resolving Func<TResult>. It consists of the ADO.NET provider invariant name and the database server name as specified in the connection string.

IncludeMetadataConvention

This DbModelBuilder convention causes DbModelBuilder to include metadata about the model when it builds the model. When DbContext creates a model by convention it will add this convention to the list of those used by the DbModelBuilder. This will then result in model metadata being written to the database if the DbContext is used to create the database. This can then be used as a quick check to see if the model has changed since the last time it was used against the database. This convention can be removed from the DbModelBuilder conventions by overriding the OnModelCreating method on a derived DbContext class.

LocalDbConnectionFactory

Instances of this class are used to create DbConnection objects for SQL Server LocalDb based on a given database name or connection string.

ModelContainerConvention

This DbModelBuilder convention uses the name of the derived DbContext class as the container for the conceptual model built by Code First.

ModelNamespaceConvention

This DbModelBuilder convention uses the namespace of the derived DbContext class as the namespace of the conceptual model built by Code First.

ObjectReferenceEqualityComparer

Compares objects using reference equality.

ReplacementDbQueryWrapper<TElement>

Instances of this class are used internally to create constant expressions for ObjectQuery<T> that are inserted into the expression tree to replace references to DbQuery<TResult> and DbQuery.

RetryLimitExceededException

The exception that is thrown when the action failed again after being retried the configured number of times.

SqlCeConnectionFactory

Instances of this class are used to create DbConnection objects for SQL Server Compact Edition based on a given database name or connection string.

SqlConnectionFactory

Instances of this class are used to create DbConnection objects for SQL Server based on a given database name or connection string. By default, the connection is made to '.\SQLEXPRESS'. This can be changed by changing the base connection string when constructing a factory instance.

SuppressDbSetInitializationAttribute

This attribute can be applied to either an entire derived DbContext class or to individual DbSet<TEntity> or IDbSet<TEntity> properties on that class. When applied any discovered DbSet<TEntity> or IDbSet<TEntity> properties will still be included in the model but will not be automatically initialized.

TableExistenceChecker

Implemented by Entity Framework providers and used to check whether or not tables exist in a given database. This is used by database initializers when determining whether or not to treat an existing database as empty such that tables should be created.

TransactionContext

This class is used by CommitFailureHandler to write and read transaction tracing information from the database. To customize the definition of the transaction table you can derive from this class and override OnModelCreating(DbModelBuilder). Derived classes can be registered using DbConfiguration.

TransactionHandler

The base class for interceptors that handle the transaction operations. Derived classes can be registered using SetDefaultTransactionHandler(Func<TransactionHandler>) or SetTransactionHandler(String, Func<TransactionHandler>, String).

TransactionRow

Rrepresents a transaction

UnintentionalCodeFirstException

Thrown when a context is generated from the DbContext templates in Database First or Model First mode and is then used in Code First mode.

Interfaces

IDbAsyncEnumerable

Asynchronous version of the IEnumerable interface that allows elements to be retrieved asynchronously. This interface is used to interact with Entity Framework queries and shouldn't be implemented by custom classes.

IDbAsyncEnumerable<T>

Asynchronous version of the IEnumerable<T> interface that allows elements of the enumerable sequence to be retrieved asynchronously. This interface is used to interact with Entity Framework queries and shouldn't be implemented by custom classes.

IDbAsyncEnumerator

Asynchronous version of the IEnumerator interface that allows elements to be retrieved asynchronously. This interface is used to interact with Entity Framework queries and shouldn't be implemented by custom classes.

IDbAsyncEnumerator<T>

Asynchronous version of the IEnumerator<T> interface that allows elements to be retrieved asynchronously. This interface is used to interact with Entity Framework queries and shouldn't be implemented by custom classes.

IDbAsyncQueryProvider

Defines methods to create and asynchronously execute queries that are described by an IQueryable object. This interface is used to interact with Entity Framework queries and shouldn't be implemented by custom classes.

IDbConnectionFactory

Implementations of this interface are used to create DbConnection objects for a type of database server based on a given database name. An Instance is set on the Database class to cause all DbContexts created with no connection information or just a database name or connection string to use a certain type of database server by default. Two implementations of this interface are provided: SqlConnectionFactory is used to create connections to Microsoft SQL Server, including EXPRESS editions. SqlCeConnectionFactory is used to create connections to Microsoft SQL Server Compact Editions. Other implementations for other database servers can be added as needed. Note that implementations should be thread safe or immutable since they may be accessed by multiple threads at the same time.

IDbContextFactory<TContext>

A factory for creating derived DbContext instances. Implement this interface to enable design-time services for context types that do not have a public default constructor. At design-time, derived DbContext instances can be created in order to enable specific design-time experiences such as model rendering, DDL generation etc. To enable design-time instantiation for derived DbContext types that do not have a public, default constructor, implement this interface. Design-time services will auto-discover implementations of this interface that are in the same assembly as the derived DbContext type.

IDbExecutionStrategy

A strategy that is used to execute a command or query against the database, possibly with logic to retry when a failure occurs.

IDbModelCacheKey

Represents a key value that uniquely identifies an Entity Framework model that has been loaded into memory.

IDbModelCacheKeyProvider

Implement this interface on your context to use custom logic to calculate the key used to lookup an already created model in the cache. This interface allows you to have a single context type that can be used with different models in the same AppDomain, or multiple context types that use the same model.

IDbProviderFactoryResolver

A service for obtaining the correct DbProviderFactory from a given DbConnection.

IManifestTokenResolver

A service for getting a provider manifest token given a connection. The DefaultManifestTokenResolver class is used by default and makes use of the underlying provider to get the token which often involves opening the connection. A different implementation can be used instead by adding an IDbDependencyResolver to DbConfiguration that may use any information in the connection to return the token. For example, if the connection is known to point to a SQL Server 2008 database then "2008" can be returned without opening the connection.

IMetadataAnnotationSerializer

Implement this interface to allow custom annotations represented by MetadataProperty instances to be serialized to and from the EDMX XML. Usually a serializer instance is set using the SetMetadataAnnotationSerializer(String, Func<IMetadataAnnotationSerializer>) method.

IObjectContextAdapter

Interface implemented by objects that can provide an ObjectContext instance. The DbContext class implements this interface to provide access to the underlying ObjectContext.

IProviderInvariantName

Used by IDbDependencyResolver and DbConfiguration when resolving a provider invariant name from a DbProviderFactory.

Enums

DbConnectionStringOrigin

Describes the origin of the database connection string associated with a DbContext.