IServiceCollection 接口

定义

为服务描述符集合指定协定。

public interface class IServiceCollection : System::Collections::Generic::ICollection<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>, System::Collections::Generic::IEnumerable<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>, System::Collections::Generic::IList<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>
public interface IServiceCollection : System.Collections.Generic.ICollection<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IList<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>
type IServiceCollection = interface
    interface IList<ServiceDescriptor>
    interface ICollection<ServiceDescriptor>
    interface seq<ServiceDescriptor>
    interface IEnumerable
type IServiceCollection = interface
    interface ICollection<ServiceDescriptor>
    interface seq<ServiceDescriptor>
    interface IEnumerable
    interface IList<ServiceDescriptor>
Public Interface IServiceCollection
Implements ICollection(Of ServiceDescriptor), IEnumerable(Of ServiceDescriptor), IList(Of ServiceDescriptor)
派生
实现

属性

Count

获取 ICollection<T> 中包含的元素数。

(继承自 ICollection<T>)
IsReadOnly

获取一个值,该值指示 ICollection<T> 是否为只读。

(继承自 ICollection<T>)
Item[Int32]

获取或设置指定索引处的元素。

(继承自 IList<T>)

方法

Add(T)

将某项添加到 ICollection<T> 中。

(继承自 ICollection<T>)
Clear()

ICollection<T> 中移除所有项。

(继承自 ICollection<T>)
Contains(T)

确定 ICollection<T> 是否包含特定值。

(继承自 ICollection<T>)
CopyTo(T[], Int32)

从特定的 ICollection<T> 索引开始,将 Array 的元素复制到一个 Array 中。

(继承自 ICollection<T>)
GetEnumerator()

返回循环访问集合的枚举数。

(继承自 IEnumerable)
IndexOf(T)

确定 IList<T> 中特定项的索引。

(继承自 IList<T>)
Insert(Int32, T)

IList<T> 中的指定索引处插入一个项。

(继承自 IList<T>)
Remove(T)

ICollection<T> 中移除特定对象的第一个匹配项。

(继承自 ICollection<T>)
RemoveAt(Int32)

移除位于指定索引处的 IList<T> 项。

(继承自 IList<T>)

扩展方法

AddServiceLogEnricher(IServiceCollection)

将服务扩充器实例添加到 。IServiceCollection

AddServiceLogEnricher(IServiceCollection, IConfigurationSection)

将服务扩充器实例添加到 。IServiceCollection

AddServiceLogEnricher(IServiceCollection, Action<ApplicationLogEnricherOptions>)

将服务扩充器实例添加到 。IServiceCollection

AddApplicationMetadata(IServiceCollection, IConfigurationSection)

将 的 ApplicationMetadata 实例添加到依赖项注入容器。

AddApplicationMetadata(IServiceCollection, Action<ApplicationMetadata>)

将 的 ApplicationMetadata 实例添加到依赖项注入容器。

AddAsyncState(IServiceCollection)

添加 、 IAsyncContext<T>Microsoft.Extensions.AsyncState.IAsyncLocalContext`1 服务的默认实现IAsyncState。 请注意,这些接口的实现不是线程安全的。

ActivateKeyedSingleton(IServiceCollection, Type, Object)

在启动时(而不是运行时)强制实施密钥单一实例激活。

ActivateKeyedSingleton<TService>(IServiceCollection, Object)

在启动时(而不是运行时)强制实施密钥单一实例激活。

ActivateSingleton(IServiceCollection, Type)

在启动时(而不是运行时)强制实施单一实例激活。

ActivateSingleton<TService>(IServiceCollection)

在启动时(而不是运行时)强制实施单一实例激活。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object, Type)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton<TService>(IServiceCollection, Object)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

添加自动激活的密钥单一实例服务。

AddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

添加自动激活的密钥单一实例服务。

AddActivatedSingleton(IServiceCollection, Type)

将 serviceType 中指定的类型的自动激活单一实例服务添加到指定的 IServiceCollection

AddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

添加自动激活的单一实例服务。

AddActivatedSingleton(IServiceCollection, Type, Type)

添加自动激活的单一实例服务。

AddActivatedSingleton<TService>(IServiceCollection)

添加自动激活的单一实例服务。

AddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

添加自动激活的单一实例服务。

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

添加自动激活的单一实例服务。

AddActivatedSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

添加自动激活的单一实例服务。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object, Type)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedKeyedSingleton<TService>(IServiceCollection, Object)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

尝试添加自动激活的密钥单一实例服务。

TryAddActivatedSingleton(IServiceCollection, Type)

尝试添加自动激活的单一实例服务。

TryAddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

尝试添加自动激活的单一实例服务。

TryAddActivatedSingleton(IServiceCollection, Type, Type)

尝试添加自动激活的单一实例服务。

TryAddActivatedSingleton<TService>(IServiceCollection)

尝试添加自动激活的单一实例服务。

TryAddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

尝试添加自动激活的单一实例服务。

TryAddActivatedSingleton<TService,TImplementation>(IServiceCollection)

尝试添加自动激活的单一实例服务。

AddTelemetryHealthCheckPublisher(IServiceCollection)

检查发布者注册运行状况,该发布者发出表示应用程序运行状况的遥测数据。

AddTelemetryHealthCheckPublisher(IServiceCollection, IConfigurationSection)

检查发布者注册运行状况,该发布者发出表示应用程序运行状况的遥测数据。

AddTelemetryHealthCheckPublisher(IServiceCollection, Action<TelemetryHealthCheckPublisherOptions>)

检查发布者注册运行状况,该发布者发出表示应用程序运行状况的遥测数据。

AddContextualOptions(IServiceCollection)

添加使用上下文选项所需的服务。

Configure<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

注册用于配置特定类型的选项的操作。

Configure<TOptions>(IServiceCollection, Func<IOptionsContext,CancellationToken,ValueTask<IConfigureContextualOptions<TOptions>>>)

注册用于配置特定类型的选项的操作。

Configure<TOptions>(IServiceCollection, String, Action<IOptionsContext,TOptions>)

注册用于配置特定类型的选项的操作。

Configure<TOptions>(IServiceCollection, String, Func<IOptionsContext,CancellationToken,ValueTask<IConfigureContextualOptions<TOptions>>>)

注册用于配置特定类型的选项的操作。

PostConfigure<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

注册用于初始化特定类型的选项的操作。

PostConfigure<TOptions>(IServiceCollection, String, Action<IOptionsContext,TOptions>)

注册用于初始化特定类型的选项的操作。

PostConfigureAll<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

注册用于初始化特定类型选项的所有实例的操作。

ValidateContextualOptions<TOptions>(IServiceCollection, Func<TOptions,Boolean>, String)

注册选项类型的验证操作。

ValidateContextualOptions<TOptions>(IServiceCollection, String, Func<TOptions,Boolean>, String)

注册选项类型的验证操作。

AddWebEncoders(IServiceCollection)

HtmlEncoderJavaScriptEncoderUrlEncoder 添加到指定的 services 中。

AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>)

HtmlEncoderJavaScriptEncoderUrlEncoder 添加到指定的 services 中。

AddLogEnricher(IServiceCollection, ILogEnricher)

注册日志扩充器实例。

AddLogEnricher<T>(IServiceCollection)

注册日志扩充器类型。

AddStaticLogEnricher(IServiceCollection, IStaticLogEnricher)

注册静态日志扩充器实例。

AddStaticLogEnricher<T>(IServiceCollection)

注册静态日志扩充器类型。

AddExceptionSummarizer(IServiceCollection)

将异常摘要生成器注册到依赖项注入容器中。

AddExceptionSummarizer(IServiceCollection, Action<IExceptionSummarizationBuilder>)

将异常摘要生成器注册到依赖项注入容器中。

Add(IServiceCollection, ServiceDescriptor)

将指定的 descriptor 添加到 collection

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceDescriptor 序列添加到 collection 中。

RemoveAll(IServiceCollection, Type)

删除 IServiceCollection 中所有 serviceType 类型的服务。

RemoveAll<T>(IServiceCollection)

删除 IServiceCollection 中所有 T 类型的服务。

RemoveAllKeyed(IServiceCollection, Type, Object)

删除 collection 中所有 serviceType 类型的服务。

RemoveAllKeyed<T>(IServiceCollection, Object)

删除 collection 中所有 T 类型的服务。

Replace(IServiceCollection, ServiceDescriptor)

删除 IServiceCollection 中与 descriptor 的服务类型相同的第一个服务,并将 descriptor 添加到集合中。

TryAdd(IServiceCollection, ServiceDescriptor)

如果服务类型尚未注册,则将指定的 descriptor 添加到 collection 中。

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果服务类型尚未注册,则将指定的 descriptors 添加到 collection 中。

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加 ServiceDescriptor

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加指定的 ServiceDescriptor

TryAddKeyedScoped(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddKeyedScoped(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddKeyedScoped<TService>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 Scoped 服务添加到 collection 中。

TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Scoped 服务添加到 services 中。

TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Scoped 服务实现类型添加到 collection 中。

TryAddKeyedSingleton(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton<TService>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

如果服务类型尚未注册,则将指定的 TService 作为包含 instance 中指定的实例的 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Singleton 服务添加到 services 中。

TryAddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Singleton 服务实现类型添加到 collection 中。

TryAddKeyedTransient(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddKeyedTransient(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddKeyedTransient<TService>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 Transient 服务添加到 collection 中。

TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Transient 服务添加到 services 中。

TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Transient 服务实现类型添加到 collection 中。

TryAddScoped(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddScoped(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddScoped<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Scoped 服务添加到 collection 中。

TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Scoped 服务添加到 services 中。

TryAddScoped<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Scoped 服务实现类型添加到 collection 中。

TryAddSingleton(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddSingleton(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddSingleton<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Singleton 服务添加到 collection 中。

TryAddSingleton<TService>(IServiceCollection, TService)

如果服务类型尚未注册,则将指定的 TService 作为包含 instance 中指定的实例的 Singleton 服务添加到 collection 中。

TryAddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Singleton 服务添加到 services 中。

TryAddSingleton<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Singleton 服务实现类型添加到 collection 中。

TryAddTransient(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddTransient(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddTransient<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Transient 服务添加到 collection 中。

TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Transient 服务添加到 services 中。

TryAddTransient<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Transient 服务实现类型添加到 collection 中。

AddFakeLogging(IServiceCollection)

使用默认选项配置虚假日志记录。

AddFakeLogging(IServiceCollection, IConfigurationSection)

配置虚假日志记录。

AddFakeLogging(IServiceCollection, Action<FakeLogCollectorOptions>)

配置虚假日志记录。

AddFakeRedaction(IServiceCollection)

注册始终返回假重修器实例的假重设函数提供程序。

AddFakeRedaction(IServiceCollection, Action<FakeRedactorOptions>)

注册始终返回假重修器实例的假重设函数提供程序。

AddHealthChecks(IServiceCollection)

使用提供的委托注册运行状况检查,以将 HealthCheckService 添加到容器中。

AddHttpClient(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection

AddHttpClient(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

AddHttpClient<TClient>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的全名。

AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Func<HttpClient,TImplementation>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Func<HttpClient,IServiceProvider,TImplementation>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Func<HttpClient,TImplementation>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Func<HttpClient,IServiceProvider,TImplementation>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

ConfigureHttpClientDefaults(IServiceCollection, Action<IHttpClientBuilder>)

添加将用于配置所有 HttpClient 实例的委托。

AddHttpClientLatencyTelemetry(IServiceCollection)

添加 以 DelegatingHandler 收集延迟信息并扩充所有 http 客户端的传出请求日志。

AddHttpClientLatencyTelemetry(IServiceCollection, IConfigurationSection)

添加 以 DelegatingHandler 收集延迟信息并扩充所有 http 客户端的传出请求日志。

AddHttpClientLatencyTelemetry(IServiceCollection, Action<HttpClientLatencyTelemetryOptions>)

添加 以 DelegatingHandler 收集延迟信息并扩充所有 http 客户端的传出请求日志。

AddExtendedHttpClientLogging(IServiceCollection)

添加 , IHttpClientAsyncLogger 以针对使用 IHttpClientFactory创建的所有 HTTP 客户端发出传出请求的日志。

AddExtendedHttpClientLogging(IServiceCollection, IConfigurationSection)

添加 , IHttpClientAsyncLogger 以针对使用 IHttpClientFactory创建的所有 HTTP 客户端发出传出请求的日志。

AddExtendedHttpClientLogging(IServiceCollection, Action<LoggingOptions>)

添加 , IHttpClientAsyncLogger 以针对使用 IHttpClientFactory创建的所有 HTTP 客户端发出传出请求的日志。

AddHttpClientLogEnricher<T>(IServiceCollection)

将 的 T 扩充器实例添加到 以 IServiceCollection 扩充 HttpClient 日志。

AddDownstreamDependencyMetadata(IServiceCollection, IDownstreamDependencyMetadata)

添加依赖项元数据。

AddDownstreamDependencyMetadata<T>(IServiceCollection)

添加依赖项元数据。

AddKubernetesProbes(IServiceCollection)

使用默认选项注册运行情况、启动和就绪情况探测。

AddKubernetesProbes(IServiceCollection, IConfigurationSection)

使用配置的选项注册运行情况、启动和就绪情况探测。

AddKubernetesProbes(IServiceCollection, Action<KubernetesProbesOptions>)

使用配置的选项注册运行情况、启动和就绪情况探测。

AddConsoleLatencyDataExporter(IServiceCollection)

为控制台添加延迟数据导出程序。

AddConsoleLatencyDataExporter(IServiceCollection, IConfigurationSection)

为控制台添加延迟数据导出程序。

AddConsoleLatencyDataExporter(IServiceCollection, Action<LatencyConsoleOptions>)

为控制台添加延迟数据导出程序。

AddLatencyContext(IServiceCollection)

添加延迟上下文。

AddLatencyContext(IServiceCollection, IConfigurationSection)

添加延迟上下文。

AddLatencyContext(IServiceCollection, Action<LatencyContextOptions>)

添加延迟上下文。

RegisterCheckpointNames(IServiceCollection, String[])

为延迟上下文注册一组检查点名称。

RegisterMeasureNames(IServiceCollection, String[])

为延迟上下文注册一组度量值名称。

RegisterTagNames(IServiceCollection, String[])

为延迟上下文注册一组标记名称。

AddLocalization(IServiceCollection)

添加应用程序本地化所需的服务。

AddLocalization(IServiceCollection, Action<LocalizationOptions>)

添加应用程序本地化所需的服务。

AddLogging(IServiceCollection)

将日志记录服务添加到指定的 IServiceCollection

AddLogging(IServiceCollection, Action<ILoggingBuilder>)

将日志记录服务添加到指定的 IServiceCollection

AddDistributedMemoryCache(IServiceCollection)

添加 IDistributedCache 的默认实现,该实现将内存中的项存储到 IServiceCollection 中。 需要分布式缓存才能工作的框架可安全地将此依赖项添加到其依赖列表中,以确保至少有一个可用的实现。

AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>)

添加 IDistributedCache 的默认实现,该实现将内存中的项存储到 IServiceCollection 中。 需要分布式缓存才能工作的框架可安全地将此依赖项添加到其依赖列表中,以确保至少有一个可用的实现。

AddMemoryCache(IServiceCollection)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

AddMetrics(IServiceCollection)

将指标服务添加到指定的 IServiceCollection

AddMetrics(IServiceCollection, Action<IMetricsBuilder>)

将指标服务添加到指定的 IServiceCollection

AddNullLatencyContext(IServiceCollection)

将无操作延迟上下文添加到依赖项注入容器。

AddPooled<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

添加 并 ObjectPool<T> 让 DI 返回作用域内实例 TService

AddPooled<TService,TImplementation>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

添加 并 ObjectPool<T> 让 DI 返回作用域内实例 TService

ConfigurePool<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

注册用于配置 DependencyInjectionPoolOptions 类型化池的 的操作。

ConfigurePools(IServiceCollection, IConfigurationSection)

配置 DI 池。

Configure<TOptions>(IServiceCollection, IConfiguration)

注册 TOptions 将绑定的配置实例,并在配置更改时更新选项。

Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>)

注册将对其绑定 TOptions 的配置实例。

Configure<TOptions>(IServiceCollection, String, IConfiguration)

注册将对其绑定 TOptions 的配置实例。

Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>)

注册将对其绑定 TOptions 的配置实例。

AddOptions(IServiceCollection)

添加使用选项所需的服务。

AddOptions<TOptions>(IServiceCollection)

获取一个选项生成器,该生成器将同一命名TOptions的 调用转发Configure到基础服务集合。

AddOptions<TOptions>(IServiceCollection, String)

获取一个选项生成器,该生成器将同一命名TOptions的 调用转发Configure到基础服务集合。

AddOptionsWithValidateOnStart<TOptions>(IServiceCollection, String)

添加使用选项所需的服务,并在启动时而不是运行时强制实施选项验证检查。

AddOptionsWithValidateOnStart<TOptions,TValidateOptions>(IServiceCollection, String)

添加使用选项所需的服务,并在启动时而不是运行时强制实施选项验证检查。

Configure<TOptions>(IServiceCollection, Action<TOptions>)

注册用于在启动后立即配置特定选项类型的操作。 这在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前运行。 更新配置不会再次调用该操作。

Configure<TOptions>(IServiceCollection, String, Action<TOptions>)

注册用于配置特定类型的选项的操作。 这些都在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前运行。

ConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

注册用于配置特定类型的选项的所有实例的操作。

ConfigureOptions(IServiceCollection, Object)

注册一个对象,该对象将注册所有对象 I[Post]ConfigureOptions

ConfigureOptions(IServiceCollection, Type)

注册一个类型,该类型将注册其 I[Post]ConfigureOptions 所有类型。

ConfigureOptions<TConfigureOptions>(IServiceCollection)

注册一个类型,该类型将注册其 I[Post]ConfigureOptions 所有类型。

PostConfigure<TOptions>(IServiceCollection, Action<TOptions>)

注册用于初始化特定类型的选项的操作。 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。

PostConfigure<TOptions>(IServiceCollection, String, Action<TOptions>)

注册用于配置特定类型的选项的操作。 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。

PostConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

注册用于对特定类型的选项的所有实例进行后期配置的操作。 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。

AddPolicyRegistry(IServiceCollection)

在服务集合中使用服务类型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 注册空的 PolicyRegistry,并返回新创建的注册表。

AddPolicyRegistry(IServiceCollection, IPolicyRegistry<String>)

在服务集合中使用服务类型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 注册提供的 IPolicyRegistry<TKey>,并返回提供的注册表。

AddProcessLogEnricher(IServiceCollection)

将进程扩充器实例添加到 。IServiceCollection

AddProcessLogEnricher(IServiceCollection, IConfigurationSection)

将主机扩充器实例添加到 IServiceCollection

AddProcessLogEnricher(IServiceCollection, Action<ProcessLogEnricherOptions>)

将进程扩充器实例添加到 。IServiceCollection

AddRedaction(IServiceCollection)

在 中IServiceCollection注册 的IRedactorProvider实现。

AddRedaction(IServiceCollection, Action<IRedactionBuilder>)

在 中IServiceCollection注册 的IRedactorProvider实现,并配置可用的 redactors。

AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>)

将 Redis 分布式缓存服务添加到指定的 IServiceCollection

AddResilienceEnricher(IServiceCollection)

添加复原扩充器。

AddResourceMonitoring(IServiceCollection)

配置实现并将其添加到 IResourceMonitor 服务集合。

AddResourceMonitoring(IServiceCollection, Action<IResourceMonitorBuilder>)

配置实现并将其添加到 IResourceMonitor 服务集合。

BuildServiceProvider(IServiceCollection)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务。

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。

BuildServiceProvider(IServiceCollection, Boolean)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。

AddHostedService<THostedService>(IServiceCollection)

添加给定类型的 IHostedService 注册。

AddHostedService<THostedService>(IServiceCollection, Func<IServiceProvider,THostedService>)

添加给定类型的 IHostedService 注册。

AddKeyedScoped(IServiceCollection, Type, Object)

serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddKeyedScoped(IServiceCollection, Type, Object, Type)

serviceType 中指定类型的范围内的服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedScoped<TService>(IServiceCollection, Object)

TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)

TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedScoped<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedSingleton(IServiceCollection, Type, Object)

serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddKeyedSingleton(IServiceCollection, Type, Object, Object)

serviceType 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。

AddKeyedSingleton(IServiceCollection, Type, Object, Type)

serviceType 中指定类型的单一实例服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedSingleton<TService>(IServiceCollection, Object)

TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddKeyedSingleton<TService>(IServiceCollection, Object, TService)

TService 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。

AddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedTransient(IServiceCollection, Type, Object)

serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddKeyedTransient(IServiceCollection, Type, Object, Type)

serviceType 中指定类型的暂时性服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddKeyedTransient<TService>(IServiceCollection, Object)

TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

使用 TImplementation 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddScoped(IServiceCollection, Type)

serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddScoped(IServiceCollection, Type, Type)

serviceType 中指定类型的范围内的服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddScoped<TService>(IServiceCollection)

TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。

AddScoped<TService,TImplementation>(IServiceCollection)

TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddSingleton(IServiceCollection, Type)

serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddSingleton(IServiceCollection, Type, Object)

serviceType 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。

AddSingleton(IServiceCollection, Type, Type)

serviceType 中指定类型的单一实例服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddSingleton<TService>(IServiceCollection)

TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddSingleton<TService>(IServiceCollection, TService)

TService 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。

AddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。

AddSingleton<TService,TImplementation>(IServiceCollection)

TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddTransient(IServiceCollection, Type)

serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddTransient(IServiceCollection, Type, Type)

serviceType 中指定类型的暂时性服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。

AddTransient<TService>(IServiceCollection)

TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddTransient<TService,TImplementation>(IServiceCollection)

使用 TImplementation 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。

AddTransient<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。

AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>)

将 Microsoft SQL Server 分布式缓存服务添加到指定的 IServiceCollection 中。

AddStackExchangeRedisCache(IServiceCollection, Action<RedisCacheOptions>)

将 Redis 分布式缓存服务添加到指定的 IServiceCollection

AddTcpEndpointProbe(IServiceCollection)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddTcpEndpointProbe(IServiceCollection, IConfigurationSection)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddTcpEndpointProbe(IServiceCollection, Action<TcpEndpointProbesOptions>)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddTcpEndpointProbe(IServiceCollection, String)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddTcpEndpointProbe(IServiceCollection, String, IConfigurationSection)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddTcpEndpointProbe(IServiceCollection, String, Action<TcpEndpointProbesOptions>)

如果服务被视为 IHealthCheck正常,则使用 TCP 端口注册运行状况报告。

AddSystemd(IServiceCollection)

为服务描述符集合指定协定。

AddWindowsService(IServiceCollection)

为服务描述符集合指定协定。

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

为服务描述符集合指定协定。

AsReadOnly<T>(IList<T>)

返回指定列表的只读 ReadOnlyCollection<T> 包装器。

CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRow

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRow

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRow

适用于