ObjectPoolServiceCollectionExtensions.AddPooled 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
AddPooled<TService,TImplementation>(IServiceCollection, Action<DependencyInjectionPoolOptions>) |
ObjectPool<T>添加 并让 DI 返回作用域的 |
AddPooled<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>) |
ObjectPool<T>添加 并让 DI 返回作用域的 |
AddPooled<TService,TImplementation>(IServiceCollection, Action<DependencyInjectionPoolOptions>)
ObjectPool<T>添加 并让 DI 返回作用域的 TService
实例。
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddPooled<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.Extensions.ObjectPool.DependencyInjectionPoolOptions>? configure = default) where TService : class where TImplementation : class, TService;
static member AddPooled : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.Extensions.ObjectPool.DependencyInjectionPoolOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddPooled(Of TService As Class, TImplementation As Class) (services As IServiceCollection, Optional configure As Action(Of DependencyInjectionPoolOptions) = Nothing) As IServiceCollection
类型参数
- TService
要池的对象的类型。
- TImplementation
要使用的实现的类型。
参数
- services
- IServiceCollection
要添加到的 IServiceCollection。
- configure
- Action<DependencyInjectionPoolOptions>
池的配置。
返回
提供的服务集合。
例外
services
为 null
。
注解
默认容量为 1024。 可以通过从 DI 容器解析 ObjectPool<T> 来获取共用类型实例。
适用于
AddPooled<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>)
ObjectPool<T>添加 并让 DI 返回作用域的 TService
实例。
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddPooled<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.Extensions.ObjectPool.DependencyInjectionPoolOptions>? configure = default) where TService : class;
static member AddPooled : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.Extensions.ObjectPool.DependencyInjectionPoolOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddPooled(Of TService As Class) (services As IServiceCollection, Optional configure As Action(Of DependencyInjectionPoolOptions) = Nothing) As IServiceCollection
类型参数
- TService
要池的对象的类型。
参数
- services
- IServiceCollection
要添加到的 IServiceCollection。
- configure
- Action<DependencyInjectionPoolOptions>
用于配置池选项的操作。
返回
提供的服务集合。
例外
services
为 null
。
注解
默认容量为 1024。 可以通过从 DI 容器解析 ObjectPool<T> 来获取共用类型实例。