แชร์ผ่าน


AutoActivationExtensions.ActivateSingleton Method

Definition

Overloads

ActivateSingleton(IServiceCollection, Type)

Enforces singleton activation at startup time rather than at runtime.

ActivateSingleton<TService>(IServiceCollection)

Enforces singleton activation at startup time rather than at runtime.

ActivateSingleton(IServiceCollection, Type)

Source:
AutoActivationExtensions.cs

Enforces singleton activation at startup time rather than at runtime.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ ActivateSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType);
static member ActivateSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function ActivateSingleton (services As IServiceCollection, serviceType As Type) As IServiceCollection

Parameters

services
IServiceCollection

The service collection containing the service.

serviceType
Type

The type of the service to activate.

Returns

The value of services.

Applies to

ActivateSingleton<TService>(IServiceCollection)

Source:
AutoActivationExtensions.cs

Enforces 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 ^ ActivateSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class;
static member ActivateSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function ActivateSingleton(Of TService As Class) (services As IServiceCollection) As IServiceCollection

Type Parameters

TService

The type of the service to activate.

Parameters

services
IServiceCollection

The service collection containing the service.

Returns

The value of services.

Applies to