AutoActivationExtensions.ActivateKeyedSingleton 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ActivateKeyedSingleton(IServiceCollection, Type, Object) |
在啟動時,而不是在運行時間強制執行索引鍵單一啟用。 |
ActivateKeyedSingleton<TService>(IServiceCollection, Object) |
在啟動時,而不是在運行時間強制執行索引鍵單一啟用。 |
ActivateKeyedSingleton(IServiceCollection, Type, Object)
在啟動時,而不是在運行時間強制執行索引鍵單一啟用。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ ActivateKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, System::Object ^ serviceKey);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateKeyedSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object? serviceKey);
static member ActivateKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function ActivateKeyedSingleton (services As IServiceCollection, serviceType As Type, serviceKey As Object) As IServiceCollection
參數
- services
- IServiceCollection
要加入服務的服務集合。
- serviceType
- Type
要啟動的服務類型。
- serviceKey
- Object
用來唯一識別特定服務的物件。
傳回
services
的值。
適用於
ActivateKeyedSingleton<TService>(IServiceCollection, Object)
在啟動時,而不是在運行時間強制執行索引鍵單一啟用。
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ ActivateKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateKeyedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey) where TService : class;
static member ActivateKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function ActivateKeyedSingleton(Of TService As Class) (services As IServiceCollection, serviceKey As Object) As IServiceCollection
類型參數
- TService
要啟動的服務類型。
參數
- services
- IServiceCollection
包含服務的服務集合。
- serviceKey
- Object
用來唯一識別特定服務的物件。
傳回
services
的值。