语言

CoreOptionsExtension 类

定义

表示由 Entity Framework 核心管理的选项,而不是由数据库提供程序或扩展管理的选项。 这些选项是使用 DbContextOptionsBuilder.

此类的实例设计为不可变。 若要更改选项,请调用其中一个“With...”用于获取选项已更改的新实例的方法。

[System.Runtime.CompilerServices.Nullable(0)]
public class CoreOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtension
public class CoreOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtension
public class CoreOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo
[<System.Runtime.CompilerServices.Nullable(0)>]
type CoreOptionsExtension = class
    interface IDbContextOptionsExtension
type CoreOptionsExtension = class
    interface IDbContextOptionsExtension
type CoreOptionsExtension = class
    interface IDbContextOptionsExtensionWithDebugInfo
    interface IDbContextOptionsExtension
Public Class CoreOptionsExtension
Implements IDbContextOptionsExtension
Public Class CoreOptionsExtension
Implements IDbContextOptionsExtensionWithDebugInfo
继承
CoreOptionsExtension
特性
实现

注解

有关详细信息和示例,请参阅 数据库提供程序和扩展的实现 。

构造函数

名称 说明
CoreOptionsExtension()

创建一组新的选项,其中所有选项都设置为默认值。

CoreOptionsExtension(CoreOptionsExtension)

实现 Clone() 方法时由派生类构造函数调用。

属性

名称 说明
ApplicationServiceProvider

方法中 UseApplicationServiceProvider(IServiceProvider) 设置的选项。

AsyncSeeder

方法中 UseAsyncSeeding(Func<DbContext,Boolean,CancellationToken,Task>) 设置的选项。

AutoResolveRootProvider

方法中 UseRootApplicationServiceProvider(IServiceProvider) 设置的选项。

DbContextLogger

方法中 LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>) 设置的选项。

DetailedErrorsEnabled

方法中 EnableDetailedErrors(Boolean) 设置的选项。

Info

有关扩展的信息/元数据。

Interceptors

从 AddInterceptors(IEnumerable<IInterceptor>) 作用域侦听器的方法设置的选项。

InternalServiceProvider

方法中 UseInternalServiceProvider(IServiceProvider) 设置的选项。

IsSensitiveDataLoggingEnabled

方法中 EnableSensitiveDataLogging(Boolean) 设置的选项。

LogFragment

创建一个消息片段,用于日志记录通常包含有关已配置的任何有用非默认选项的信息。

LoggerFactory

方法中 UseLoggerFactory(ILoggerFactory) 设置的选项。

LoggingCacheTime

方法中 AddDbContextPool<TContext>(IServiceCollection, Action<DbContextOptionsBuilder>, Int32) 设置的选项。

MaxPoolSize

方法中 AddDbContextPool<TContext>(IServiceCollection, Action<DbContextOptionsBuilder>, Int32) 设置的选项。

MemoryCache

方法中 UseMemoryCache(IMemoryCache) 设置的选项。

Model

方法中 UseModel(IModel) 设置的选项。

QueryTrackingBehavior

方法中 UseQueryTrackingBehavior(QueryTrackingBehavior) 设置的选项。

ReplacedServices

方法 ReplaceService<TService,TImplementation>() 中设置的选项。

RootApplicationServiceProvider

方法中 UseRootApplicationServiceProvider(IServiceProvider) 设置的选项。

Seeder

方法中 UseSeeding(Action<DbContext,Boolean>) 设置的选项。

ServiceProviderCachingEnabled

方法中 EnableServiceProviderCaching(Boolean) 设置的选项。

SingletonInterceptors

从 AddInterceptors(IEnumerable<IInterceptor>) 单一实例拦截器的方法设置的选项。

ThreadSafetyChecksEnabled

方法中 EnableThreadSafetyChecks(Boolean) 设置的选项。

WarningsConfiguration

方法 ConfigureWarnings(Action<WarningsConfigurationBuilder>) 中设置的选项。

方法

名称 说明
ApplyServices(IServiceCollection)

添加使所选选项正常工作所需的服务。 如果没有外部 IServiceProvider 提供程序,EF 在内部维护自己的服务提供商,则使用此方法。 这允许数据库提供程序(和其他扩展)在 EF 创建服务提供程序时注册其所需的服务。

Clone()

重写派生类中的此方法,以确保创建的任何克隆也是该类的。

GetServiceProviderHashCode()

返回从任何将导致需要新 IServiceProvider 选项创建的哈希代码。

PopulateDebugInfo(IDictionary<String,String>)

填充可能在扩展使用之间更改的信息字典,以便可以将其与以前针对此选项的配置进行比较,并且可以记录差异。 使用字典键前缀 "Core:" 。

Validate(IDbContextOptions)

使扩展有机会验证扩展中的所有选项是否有效。 如果选项无效,则会引发异常。

WithApplicationServiceProvider(IServiceProvider)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithAsyncSeeding(Func<DbContext,Boolean,CancellationToken,Task>)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithDbContextLogger(IDbContextLogger)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithDetailedErrorsEnabled(Boolean)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithInterceptors(IEnumerable<IInterceptor>)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithInternalServiceProvider(IServiceProvider)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithLoggerFactory(ILoggerFactory)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithLoggingCacheTime(TimeSpan)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithMaxPoolSize(Nullable<Int32>)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithMemoryCache(IMemoryCache)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithModel(IModel)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithQueryTrackingBehavior(QueryTrackingBehavior)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithReplacedService(Type, Type, Type)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithReplacedService(Type, Type)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithRootApplicationServiceProvider(Boolean)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithRootApplicationServiceProvider(IServiceProvider)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithSeeding(Action<DbContext,Boolean>)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithSensitiveDataLoggingEnabled(Boolean)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithServiceProviderCachingEnabled(Boolean)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithSingletonInterceptors(IEnumerable<ISingletonInterceptor>)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithThreadSafetyChecksEnabled(Boolean)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

WithWarningsConfiguration(WarningsConfiguration)

创建与此实例相同的所有选项的新实例,但给定选项已更改。 直接调用此方法并不常见。 请改用 DbContextOptionsBuilder。

适用于