Microsoft.EntityFrameworkCore.Infrastructure Namespace

Classes

AccessorExtensions

Extension methods for IInfrastructure<T>.

These methods are typically used by database providers (and other extensions). They are generally not used in application code.

IInfrastructure<T> is used to hide properties that are not intended to be used in application code but can be used in extension methods written by database providers etc.

Annotatable

Base class for types that support reading and writing annotations.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

AnnotatableBuilder<TMetadata,TModelBuilder>

A base type with a simple API surface for configuring a ConventionAnnotatable.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

AnnotatableExtensions

Extension methods for IAnnotatable.

Annotation

An arbitrary piece of metadata that can be stored on an object that implements IAnnotatable.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ConventionAnnotatable

Base class for types that support reading and writing convention annotations.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

CoreOptionsExtension

Represents options managed by the core of Entity Framework, as opposed to those managed by database providers or extensions. These options are set using DbContextOptionsBuilder.

Instances of this class are designed to be immutable. To change an option, call one of the 'With...' methods to obtain a new instance with the option changed.

CosmosDbContextOptionsBuilder

Allows Cosmos specific configuration to be performed on DbContextOptions.

Instances of this class are returned from a call to CosmosDbContextOptionsExtensions.UseCosmos{TContext} and it is not designed to be directly constructed in your application code.

DatabaseFacade

Provides access to database related information and operations for a context. Instances of this class are typically obtained from Database and it is not designed to be directly constructed in your application code.

DbContextAttribute

Identifies the DbContext that a class belongs to. For example, this attribute is used to identify which context a migration applies to.

DbContextFactoryOptions

Provides information about the environment an application is running in.

DbContextOptionsExtensionInfo

Information/metadata for an IDbContextOptionsExtension.

DebugView

A placeholder for lazily-generated debug strings that can be expanded in the debugger to to generate and display them.

DesignTimeProviderServicesAttribute

Identifies where to find the design time services for a given database provider. This attribute should be present in the primary assembly of the database provider.

This attribute is typically used by database providers (and other extensions). It is generally not used in application code.

EntityFrameworkEventSource

An EventSource emitting Entity Framework performance counter data.

EntityFrameworkInternalAttribute

Marks an API as internal to Entity Framework Core. These APIs are not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use such APIs directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

EntityFrameworkRelationalServicesBuilder

A builder API designed for relational database providers to use when registering services.

Providers should create an instance of this class, use its methods to register services, and then call TryAddCoreServices() to fill out the remaining Entity Framework services.

Entity Framework ensures that services are registered with the appropriate scope. In some cases a provider may register a service with a different scope, but great care must be taken that all its dependencies can handle the new scope, and that it does not cause issue for services that depend on it.

EntityFrameworkServiceCollectionExtensions

Extension methods for setting up Entity Framework related services in an IServiceCollection.

EntityFrameworkServicesBuilder

A builder API designed for database providers to use when registering services.

Providers should create an instance of this class, use its methods to register services, and then call TryAddCoreServices() to fill out the remaining Entity Framework services.

Relational providers should use 'EntityFrameworkRelationalServicesBuilder instead.

Entity Framework ensures that services are registered with the appropriate scope. In some cases a provider may register a service with a different scope, but great care must be taken that all its dependencies can handle the new scope, and that it does not cause issue for services that depend on it.

ExpressionExtensions

Extension methods for Expression types.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

IndentedStringBuilder

A thin wrapper over StringBuilder that adds indentation to each line built.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

InMemoryDbContextOptionsBuilder

Allows in-memory specific configuration to be performed on DbContextOptions.

Instances of this class are returned from a call to UseInMemoryDatabase(DbContextOptionsBuilder, String, Action<InMemoryDbContextOptionsBuilder>) and it is not designed to be directly constructed in your application code.

LazyLoaderExtensions

Extension methods for the ILazyLoader service that make it more convenient to use from entity classes.

MethodInfoExtensions

Extension methods for MethodInfo.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ModelCacheKey

A key that uniquely identifies the model for a given context. This is used to store and lookup a cached model for a given context. This default implementation uses the context type as they key, thus assuming that all contexts of a given type have the same model.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ModelCacheKeyFactory

Creates keys that uniquely identifies the model for a given context. This is used to store and lookup a cached model for a given context. This default implementation uses the context type as they key, thus assuming that all contexts of a given type have the same model.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelCacheKeyFactoryDependencies

Service dependencies parameter class for ModelCacheKeyFactory

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelCustomizer

Builds the model for a given context. This implementation builds the model by calling OnModelCreating(ModelBuilder) on the context.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelCustomizerDependencies

Service dependencies parameter class for ModelCustomizer

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelDependencies

Service dependencies parameter class for IModel

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

ModelSnapshot

Base class for the snapshot of the IModel state generated by Migrations.

ModelSource

An implementation of IModelSource that produces a model based on the DbSet<TEntity> properties exposed on the context. The model is cached to avoid recreating it every time it is requested.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelSourceDependencies

Service dependencies parameter class for ModelSource

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelValidator

The validator that enforces core rules common for all providers.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ModelValidatorDependencies

Service dependencies parameter class for ModelValidator

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

NavigationBaseExtensions

Extension methods for INavigationBase.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ProductInfo

Helper class for finding the version of Entity Framework Core being used.

RelationalDbContextOptionsBuilder<TBuilder,TExtension>

Allows relational database specific configuration to be performed on DbContextOptions.

Instances of this class are typically returned from methods that configure the context to use a particular relational database provider.

RelationalModelCustomizer

Builds the model for a given context.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

RelationalModelValidator

The validator that enforces rules common for all relational providers.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

RelationalModelValidatorDependencies

Service dependencies parameter class for RelationalModelValidator

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

RelationalOptionsExtension

Represents options managed by the relational database providers. These options are set using DbContextOptionsBuilder.

Instances of this class are designed to be immutable. To change an option, call one of the 'With...' methods to obtain a new instance with the option changed.

RelationalOptionsExtension.RelationalExtensionInfo

Information/metadata for a RelationalOptionsExtension.

RelationalPropertyExtensions

Relational extension methods for IProperty.

RelationalServiceCollectionExtensions

Relational database specific extension methods for IServiceCollection.

SensitiveDataLogger<T>

A wrapping logger for which logging of sensitive data can be enabled or disabled.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ServiceCollectionMap

Provides a map over a IServiceCollection that allows ServiceDescriptor entries to be conditionally added or re-written without requiring linear scans of the service collection each time this is done.

Note that the collection should not be modified without in other ways while it is being managed by the map. The collection can be used in the normal way after modifications using the map have been completed.

SpatialiteLoader

Finds and loads SpatiaLite.

SqliteDbContextOptionsBuilder

Allows SQLite specific configuration to be performed on DbContextOptions.

Instances of this class are returned from a call to UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>) and it is not designed to be directly constructed in your application code.

SqlServerDbContextOptionsBuilder

Allows SQL Server specific configuration to be performed on DbContextOptions.

Instances of this class are returned from a call to UseSqlServer(DbContextOptionsBuilder, String, Action<SqlServerDbContextOptionsBuilder>) and it is not designed to be directly constructed in your application code.

TypeExtensions

Extension methods for Type instances.

These extensions are typically used by database providers (and other extensions). They are generally not used in application code.

Uniquifier

Provides methods for manipulating string identifiers.

WarningsConfigurationBuilder

Configures the runtime behavior of warnings generated by Entity Framework. You can set a default behavior and behaviors for each warning type.

This class is used within the ConfigureWarnings(Action<WarningsConfigurationBuilder>) API and it is not designed to be directly constructed in your application code.

Structs

ConcurrencyDetectorCriticalSectionDisposer

A IDisposable returned by an IConcurrencyDetector, which will exit the ongoing critical section when disposed.

DbSetProperty

A struct representing facets of DbSet<TEntity> property defined on DbContext derived type.

EntityFrameworkServicesBuilder.ServiceCharacteristics

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

ServiceCharacteristics

Characteristics of a given EF service.

Interfaces

IAnnotatable

A class that exposes annotations. Annotations allow for arbitrary metadata to be stored on an object.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IAnnotation

An arbitrary piece of metadata that can be stored on an object that implements IAnnotatable.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IConcurrencyDetector

Used by EF internal code and database providers to detect concurrent access to non-thread-safe resources.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

ICoreSingletonOptions

Options set at the IServiceProvider singleton level to control core options.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ICurrentDbContext

Registered as a scoped service in Entity Framework's internal service provider to provide access to the current DbContext being used.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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 Migrations. Design-time services will automatically discover implementations of this interface that are in the same assembly as the derived context.

IDbContextOptions

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder to create instances of classes that implement this interface, they are not designed to be directly created in your application code.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

IDbContextOptionsBuilderInfrastructure

Explicitly implemented by DbContextOptionsBuilder to hide methods that are used by database provider extension methods but not intended to be called by application developers.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IDbContextOptionsExtension

Interface for extensions that are stored in Extensions.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IDbContextOptionsExtensionWithDebugInfo

Extended interface for extensions that also allows for debugging info to be gathered. This interface will likely be merged into IDbContextOptionsExtension in EF Core 3.0.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IDbSetFinder

A service for finding DbSet<TEntity> properties on a type that inherits from DbContext.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IDesignTimeServices

Enables configuring design-time services. Tools will automatically discover implementations of this interface that are in the startup assembly.

IInfrastructure<T>

This interface is explicitly implemented by type to hide properties that are not intended to be used in application code but can be used in extension methods written by database providers etc.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

IInternalServiceCollectionMap

Exposes methods allowing providers to register EF service dependency objects on the internal service provider.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

ILazyLoader

A service that can be injected into entities to give them the capability of loading navigation properties automatically the first time they are accessed.

The service lifetime is 'ServiceLifetime.Transient'. This means that each entity instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

IModelCacheKeyFactory

Creates keys that uniquely identifies the model for a given context. This is used to store and lookup a cached model for a given context.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IModelCustomizer

Performs additional configuration of the model in addition to what is discovered by convention.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

When replacing this service consider deriving the implementation from ModelCustomizer or 'RelationalModelCustomizer' to preserve the default behavior.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IModelSource

Produces an IModel based on a context. This is typically implemented by database providers to ensure that any conventions and validation specific to their database are used.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IModelValidator

Validates a model after it is built.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IRelationalDbContextOptionsBuilderInfrastructure

Explicitly implemented by RelationalDbContextOptionsBuilder<TBuilder,TExtension> to hide methods that are used by database provider extension methods but not intended to be called by application developers.

IResettableService

This interface must be implemented by any service that needs to be reset between different uses of the same DbContext in different pools.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Scoped and multiple registrations are allowed. This means that each DbContext instance will use its own set of instances of this service. The implementations may depend on other services registered with any lifetime. The implementations do not need to be thread-safe.

ISensitiveDataLogger

An ILogger for which logging of sensitive data can be enabled or disabled.

ISensitiveDataLogger<T>

An ILogger<TCategoryName> for which logging of sensitive data can be enabled or disabled.

ISingletonOptions

Implemented by any class that represents options that can only be set at the IServiceProvider singleton level.

The service lifetime is Singleton and multiple registrations are allowed. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

Enums

CoreEventId

Values that are used as the eventId when logging messages from the core Entity Framework components.

DesignEventId
InMemoryEventId

Values that are used as the eventId when logging messages from the in-memory database provider via ILogger.

MetadataDebugStringOptions

Options to print debug string differently for metadata objects.

RelationalDesignEventId
RelationalEventId

Values that are used as the eventId when logging messages from a relational database provider via ILogger.

SqliteDesignEventId

Values that are used as the eventId when logging messages from the SQLite Design Entity Framework Core components.

SqlServerDesignEventId

Values that are used as the eventId when logging messages from the SQL Server Design Entity Framework Core components.