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> 可取得集區類型實例。