ObjectPoolServiceCollectionExtensions.AddPooled 方法

定义

重载

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

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

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

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

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

Source:
ObjectPoolServiceCollectionExtensions.cs
Source:
ObjectPoolServiceCollectionExtensions.cs

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>

池的配置。

返回

提供的服务集合。

例外

servicesnull

注解

默认容量为 1024。 可以通过从 DI 容器解析 ObjectPool<T> 来获取共用类型实例。

适用于

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

Source:
ObjectPoolServiceCollectionExtensions.cs
Source:
ObjectPoolServiceCollectionExtensions.cs

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>

用于配置池选项的操作。

返回

提供的服务集合。

例外

servicesnull

注解

默认容量为 1024。 可以通过从 DI 容器解析 ObjectPool<T> 来获取共用类型实例。

适用于