KeyedServiceExtensions.AddSingletonKeyedService 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddSingletonKeyedService<TKey,TService,TInstance>(IServiceCollection, TKey) |
註冊單一金鑰服務 |
AddSingletonKeyedService<TKey,TService>(IServiceCollection, TKey, Func<IServiceProvider,TKey,TService>) |
註冊單一金鑰服務 |
AddSingletonKeyedService<TKey,TService,TInstance>(IServiceCollection, TKey)
註冊單一金鑰服務
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingletonKeyedService<TKey,TService,TInstance> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, TKey key) where TService : class where TInstance : class, TService;
static member AddSingletonKeyedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * 'Key -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingletonKeyedService(Of TKey, TService, TInstance) (collection As IServiceCollection, key As TKey) As IServiceCollection
類型參數
- TKey
- TService
- TInstance
參數
- collection
- IServiceCollection
- key
- TKey
傳回
適用於
AddSingletonKeyedService<TKey,TService>(IServiceCollection, TKey, Func<IServiceProvider,TKey,TService>)
註冊單一金鑰服務
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingletonKeyedService<TKey,TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, TKey key, Func<IServiceProvider,TKey,TService> factory) where TService : class;
static member AddSingletonKeyedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * 'Key * Func<IServiceProvider, 'Key, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingletonKeyedService(Of TKey, TService) (collection As IServiceCollection, key As TKey, factory As Func(Of IServiceProvider, TKey, TService)) As IServiceCollection
類型參數
- TKey
- TService
參數
- collection
- IServiceCollection
- key
- TKey
- factory
- Func<IServiceProvider,TKey,TService>