AutoActivationExtensions.ActivateKeyedSingleton 方法

定义

重载

ActivateKeyedSingleton(IServiceCollection, Type, Object)

在启动时(而不是运行时)强制实施密钥单一实例激活。

ActivateKeyedSingleton<TService>(IServiceCollection, Object)

在启动时(而不是运行时)强制实施密钥单一实例激活。

ActivateKeyedSingleton(IServiceCollection, Type, Object)

Source:
AutoActivationExtensions.Keyed.cs

在启动时(而不是运行时)强制实施密钥单一实例激活。

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)

Source:
AutoActivationExtensions.Keyed.cs

在启动时(而不是运行时)强制实施密钥单一实例激活。

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 的值。

适用于