แชร์ผ่าน


AutoActivationExtensions.ActivateKeyedSingleton Method

Definition

Overloads

ActivateKeyedSingleton(IServiceCollection, Type, Object)

Enforces keyed singleton activation at startup time rather than at runtime.

ActivateKeyedSingleton<TService>(IServiceCollection, Object)

Enforces keyed singleton activation at startup time rather than at runtime.

ActivateKeyedSingleton(IServiceCollection, Type, Object)

Source:
AutoActivationExtensions.Keyed.cs

Enforces keyed singleton activation at startup time rather than at runtime.

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

Parameters

services
IServiceCollection

The service collection to add the service to.

serviceType
Type

The type of the service to activate.

serviceKey
Object

An object used to uniquely identify the specific service.

Returns

The value of services.

Applies to

ActivateKeyedSingleton<TService>(IServiceCollection, Object)

Source:
AutoActivationExtensions.Keyed.cs

Enforces keyed singleton activation at startup time rather than at runtime.

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

Type Parameters

TService

The type of the service to activate.

Parameters

services
IServiceCollection

The service collection containing the service.

serviceKey
Object

An object used to uniquely identify the specific service.

Returns

The value of services.

Applies to