CoreOptionsExtension Class

Definition

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.

public class CoreOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtension
public class CoreOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo
type CoreOptionsExtension = class
    interface IDbContextOptionsExtension
type CoreOptionsExtension = class
    interface IDbContextOptionsExtensionWithDebugInfo
    interface IDbContextOptionsExtension
Public Class CoreOptionsExtension
Implements IDbContextOptionsExtension
Public Class CoreOptionsExtension
Implements IDbContextOptionsExtensionWithDebugInfo
Inheritance
CoreOptionsExtension
Implements

Remarks

See Implementation of database providers and extensions for more information and examples.

Constructors

CoreOptionsExtension()

Creates a new set of options with everything set to default values.

CoreOptionsExtension(CoreOptionsExtension)

Called by a derived class constructor when implementing the Clone() method.

Properties

ApplicationServiceProvider

The option set from the UseApplicationServiceProvider(IServiceProvider) method.

AutoResolveRootProvider

The option set from the UseRootApplicationServiceProvider(IServiceProvider) method.

DbContextLogger

The option set from the LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>) method.

DetailedErrorsEnabled

The option set from the EnableDetailedErrors(Boolean) method.

Info

Information/metadata about the extension.

Interceptors

The options set from the AddInterceptors(IEnumerable<IInterceptor>) method for scoped interceptors.

InternalServiceProvider

The option set from the UseInternalServiceProvider(IServiceProvider) method.

IsSensitiveDataLoggingEnabled

The option set from the EnableSensitiveDataLogging(Boolean) method.

LogFragment

Creates a message fragment for logging typically containing information about any useful non-default options that have been configured.

LoggerFactory

The option set from the UseLoggerFactory(ILoggerFactory) method.

LoggingCacheTime

The option set from the AddDbContextPool<TContext>(IServiceCollection, Action<DbContextOptionsBuilder>, Int32) method.

MaxPoolSize

The option set from the AddDbContextPool<TContext>(IServiceCollection, Action<DbContextOptionsBuilder>, Int32) method.

MemoryCache

The option set from the UseMemoryCache(IMemoryCache) method.

Model

The option set from the UseModel(IModel) method.

QueryTrackingBehavior

The option set from the UseQueryTrackingBehavior(QueryTrackingBehavior) method.

ReplacedServices

The options set from the ReplaceService<TService,TImplementation>() method.

RootApplicationServiceProvider

The option set from the UseRootApplicationServiceProvider(IServiceProvider) method.

ServiceProviderCachingEnabled

The option set from the EnableServiceProviderCaching(Boolean) method.

SingletonInterceptors

The options set from the AddInterceptors(IEnumerable<IInterceptor>) method for singleton interceptors.

ThreadSafetyChecksEnabled

The option set from the EnableThreadSafetyChecks(Boolean) method.

WarningsConfiguration

The options set from the ConfigureWarnings(Action<WarningsConfigurationBuilder>) method.

Methods

ApplyServices(IServiceCollection)

Adds the services required to make the selected options work. This is used when there is no external IServiceProvider and EF is maintaining its own service provider internally. This allows database providers (and other extensions) to register their required services when EF is creating an service provider.

Clone()

Override this method in a derived class to ensure that any clone created is also of that class.

GetServiceProviderHashCode()

Returns a hash code created from any options that would cause a new IServiceProvider to be needed.

PopulateDebugInfo(IDictionary<String,String>)

Populates a dictionary of information that may change between uses of the extension such that it can be compared to a previous configuration for this option and differences can be logged. The dictionary key prefix "Core:" is used.

Validate(IDbContextOptions)

Gives the extension a chance to validate that all options in the extension are valid. If options are invalid, then an exception will be thrown.

WithApplicationServiceProvider(IServiceProvider)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithDbContextLogger(IDbContextLogger)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithDetailedErrorsEnabled(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithInterceptors(IEnumerable<IInterceptor>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithInternalServiceProvider(IServiceProvider)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithLoggerFactory(ILoggerFactory)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithLoggingCacheTime(TimeSpan)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMaxPoolSize(Nullable<Int32>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMemoryCache(IMemoryCache)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithModel(IModel)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithQueryTrackingBehavior(QueryTrackingBehavior)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithReplacedService(Type, Type)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithReplacedService(Type, Type, Type)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithRootApplicationServiceProvider(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithRootApplicationServiceProvider(IServiceProvider)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithSensitiveDataLoggingEnabled(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithServiceProviderCachingEnabled(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithSingletonInterceptors(IEnumerable<ISingletonInterceptor>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithThreadSafetyChecksEnabled(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithWarningsConfiguration(WarningsConfiguration)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

Applies to