IServiceCollection 接口

定义

为服务描述符集合指定协定。Specifies the contract for a collection of service descriptors.

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> 中包含的元素数。Gets the number of elements contained in the ICollection<T>.

(继承自 ICollection<T>)
IsReadOnly

获取一个值,该值指示 ICollection<T> 是否为只读。Gets a value indicating whether the ICollection<T> is read-only.

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

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

(继承自 IList<T>)

方法

Add(T)

将某项添加到 ICollection<T> 中。Adds an item to the ICollection<T>.

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

ICollection<T> 中移除所有项。Removes all items from the ICollection<T>.

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

确定 ICollection<T> 是否包含特定值。Determines whether the ICollection<T> contains a specific value.

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

从特定的 ICollection<T> 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

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

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

(继承自 IEnumerable)
IndexOf(T)

确定 IList<T> 中特定项的索引。Determines the index of a specific item in the IList<T>.

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

IList<T> 中的指定索引处插入一个项。Inserts an item to the IList<T> at the specified index.

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

ICollection<T> 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the ICollection<T>.

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

移除位于指定索引处的 IList<T> 项。Removes the IList<T> item at the specified index.

(继承自 IList<T>)

扩展方法

AddWebEncoders(IServiceCollection)

HtmlEncoderJavaScriptEncoderUrlEncoder 添加到指定的 services 中。Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>)

HtmlEncoderJavaScriptEncoderUrlEncoder 添加到指定的 services 中。Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

Add(IServiceCollection, ServiceDescriptor)

将指定的 descriptor 添加到 collectionAdds the specified descriptor to the collection.

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceDescriptor 序列添加到 collection 中。Adds a sequence of ServiceDescriptor to the collection.

RemoveAll(IServiceCollection, Type)

删除 IServiceCollection 中所有 serviceType 类型的服务。Removes all services of type serviceType in IServiceCollection.

RemoveAll<T>(IServiceCollection)

删除 IServiceCollection 中所有 T 类型的服务。Removes all services of type T in IServiceCollection.

Replace(IServiceCollection, ServiceDescriptor)

删除 IServiceCollection 中与 descriptor 的服务类型相同的第一个服务,并将 descriptor 添加到集合中。Removes the first service in IServiceCollection with the same service type as descriptor and adds descriptor to the collection.

TryAdd(IServiceCollection, ServiceDescriptor)

如果服务类型尚未注册,则将指定的 descriptor 添加到 collection 中。Adds the specified descriptor to the collection if the service type hasn't already been registered.

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果服务类型尚未注册,则将指定的 descriptors 添加到 collection 中。Adds the specified descriptors to the collection if the service type hasn't already been registered.

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加 ServiceDescriptorAdds a ServiceDescriptor if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加指定的 ServiceDescriptorAdds the specified ServiceDescriptors if an existing descriptor with the same ServiceType and an implementation that does not already exist in services.

TryAddScoped(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Scoped 服务添加到 collection 中。Adds the specified service as a Scoped service to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Scoped 服务添加到 collection 中。Adds the specified service as a Scoped service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddScoped(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Scoped 服务添加到 collection 中。Adds the specified service as a Scoped service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddScoped<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Scoped 服务添加到 collection 中。Adds the specified TService as a Scoped service to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Scoped 服务添加到 services 中。Adds the specified TService as a Scoped service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddScoped<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Scoped 服务实现类型添加到 collection 中。Adds the specified TService as a Scoped service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

TryAddSingleton(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Singleton 服务添加到 collection 中。Adds the specified service as a Singleton service to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Singleton 服务添加到 collection 中。Adds the specified service as a Singleton service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddSingleton(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Singleton 服务添加到 collection 中。Adds the specified service as a Singleton service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddSingleton<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Singleton 服务添加到 collection 中。Adds the specified TService as a Singleton service to the collection if the service type hasn't already been registered.

TryAddSingleton<TService>(IServiceCollection, TService)

如果服务类型尚未注册,则将指定的 TService 作为包含 instance 中指定的实例的 Singleton 服务添加到 collection 中。Adds the specified TService as a Singleton service with an instance specified in instance to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Singleton 服务添加到 services 中。Adds the specified TService as a Singleton service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddSingleton<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Singleton 服务实现类型添加到 collection 中。Adds the specified TService as a Singleton service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Transient 服务添加到 collection 中。Adds the specified service as a Transient service to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Transient 服务添加到 collection 中。Adds the specified service as a Transient service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Transient 服务添加到 collection 中。Adds the specified service as a Transient service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddTransient<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Transient 服务添加到 collection 中。Adds the specified TService as a Transient service to the collection if the service type hasn't already been registered.

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Transient 服务添加到 services 中。Adds the specified TService as a Transient service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddTransient<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Transient 服务实现类型添加到 collection 中。Adds the specified TService as a Transient service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

AddHealthChecks(IServiceCollection)

使用提供的委托注册运行状况检查,以将 HealthCheckService 添加到容器中。Adds the HealthCheckService to the container, using the provided delegate to register health checks.

AddHttpClient(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollectionAdds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClientAdds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClientAdds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClientAdds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient<TClient>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的全名。The client name will be set to the full name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. 客户端名称将设置为 TClient 的类型名称。The client name will be set to the type name of TClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddLocalization(IServiceCollection)

添加应用程序本地化所需的服务。Adds services required for application localization.

AddLocalization(IServiceCollection, Action<LocalizationOptions>)

添加应用程序本地化所需的服务。Adds services required for application localization.

AddLogging(IServiceCollection)

将日志记录服务添加到指定的 IServiceCollectionAdds logging services to the specified IServiceCollection.

AddLogging(IServiceCollection, Action<ILoggingBuilder>)

将日志记录服务添加到指定的 IServiceCollectionAdds logging services to the specified IServiceCollection.

AddDistributedMemoryCache(IServiceCollection)

添加 IDistributedCache 的默认实现,该实现将内存中的项存储到 IServiceCollection 中。Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. 需要分布式缓存才能工作的框架可安全地将此依赖项添加到其依赖列表中,以确保至少有一个可用的实现。Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>)

添加 IDistributedCache 的默认实现,该实现将内存中的项存储到 IServiceCollection 中。Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. 需要分布式缓存才能工作的框架可安全地将此依赖项添加到其依赖列表中,以确保至少有一个可用的实现。Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

AddMemoryCache(IServiceCollection)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.

Configure<TOptions>(IServiceCollection, IConfiguration)

注册 TOptions 将绑定的配置实例,并在配置更改时更新选项。Registers a configuration instance that TOptions will bind against, and updates the options when the configuration changes.

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

注册将对其绑定 TOptions 的配置实例。Registers a configuration instance which TOptions will bind against.

Configure<TOptions>(IServiceCollection, String, IConfiguration)

注册将对其绑定 TOptions 的配置实例。Registers a configuration instance which TOptions will bind against.

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

注册将对其绑定 TOptions 的配置实例。Registers a configuration instance which TOptions will bind against.

AddOptions(IServiceCollection)

添加使用选项所需的服务。Adds services required for using options.

AddOptions<TOptions>(IServiceCollection)

获取一个选项生成器,以便将同一命名 TOptions配置调用转发到基础服务集合。Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

AddOptions<TOptions>(IServiceCollection, String)

获取一个选项生成器,以便将同一命名 TOptions配置调用转发到基础服务集合。Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

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

注册用于在启动后立即配置特定选项类型的操作。Registers an action used to configure a particular type of options once during startup. 这在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前运行。This is run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>). 更新配置不会再次调用该操作。Updates to the configuration does not invoke the action again.

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

注册用于配置特定类型的选项的操作。Registers an action used to configure a particular type of options. 这些都在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前运行。These are run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>).

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

注册用于配置特定类型的选项的所有实例的操作。Registers an action used to configure all instances of a particular type of options.

ConfigureOptions(IServiceCollection, Object)

注册将注册其所有 I[Post]ConfigureOptions 的对象。Registers an object that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions(IServiceCollection, Type)

注册将注册其所有 I[Post]ConfigureOptions 的类型。Registers a type that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions<TConfigureOptions>(IServiceCollection)

注册将注册其所有 I[Post]ConfigureOptions 的类型。Registers a type that will have all of its I[Post]ConfigureOptions registered.

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

注册用于初始化特定类型的选项的操作。Registers an action used to initialize a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

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

注册用于配置特定类型的选项的操作。Registers an action used to configure a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

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

注册用于对特定类型的选项的所有实例进行后期配置的操作。Registers an action used to post configure all instances of a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

AddPolicyRegistry(IServiceCollection)

在服务集合中使用服务类型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 注册空的 PolicyRegistry,并返回新创建的注册表。Registers an empty PolicyRegistry in the service collection with service types IPolicyRegistry<TKey>, and IReadOnlyPolicyRegistry<TKey> and returns the newly created registry.

AddPolicyRegistry(IServiceCollection, IPolicyRegistry<String>)

在服务集合中使用服务类型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 注册提供的 IPolicyRegistry<TKey>,并返回提供的注册表。Registers the provided IPolicyRegistry<TKey> in the service collection with service types IPolicyRegistry<TKey>, and IReadOnlyPolicyRegistry<TKey> and returns the provided registry.

AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>)

将 Redis 分布式缓存服务添加到指定的 IServiceCollectionAdds Redis distributed caching services to the specified IServiceCollection.

BuildServiceProvider(IServiceCollection)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务。Creates a ServiceProvider containing services from the provided IServiceCollection.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling service-creation and scope validation.

BuildServiceProvider(IServiceCollection, Boolean)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

AddHostedService<THostedService>(IServiceCollection)

添加给定类型的 IHostedService 注册。Add an IHostedService registration for the given type.

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

添加给定类型的 IHostedService 注册。Add an IHostedService registration for the given type.

AddScoped(IServiceCollection, Type)

serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in serviceType to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddScoped(IServiceCollection, Type, Type)

serviceType 中指定类型的范围内的服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddScoped<TService>(IServiceCollection)

TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in TService to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddScoped<TService,TImplementation>(IServiceCollection)

TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的范围内的服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a scoped service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type)

serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in serviceType to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Object)

serviceType 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in serviceType with an instance specified in implementationInstance to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Type)

serviceType 中指定类型的单一实例服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection)

TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in TService to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection, TService)

TService 中指定类型的单一实例服务和 implementationInstance 中指定的实例添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in TService with an instance specified in implementationInstance to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection)

TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的单一实例服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddTransient(IServiceCollection, Type)

serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in serviceType to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 serviceType 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddTransient(IServiceCollection, Type, Type)

serviceType 中指定类型的暂时性服务和 implementationType 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddTransient<TService>(IServiceCollection)

TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in TService to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddTransient<TService,TImplementation>(IServiceCollection)

使用 TImplementation 中指定的中心将 TService 中指定类型的暂时性服务添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

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

使用 implementationFactory 中指定的中心将 TService 中指定类型的暂时性服务和 TImplementation 中指定类型的实现添加到指定的 IServiceCollection 中。Adds a transient service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>)

将 Microsoft SQL Server 分布式缓存服务添加到指定的 IServiceCollection 中。Adds Microsoft SQL Server distributed caching services to the specified IServiceCollection.

AddStackExchangeRedisCache(IServiceCollection, Action<RedisCacheOptions>)

将 Redis 分布式缓存服务添加到指定的 IServiceCollectionAdds Redis distributed caching services to the specified IServiceCollection.

CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

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

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

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

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

适用于