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.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType);

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

.NET 10 (package-provided) dan versi lain
Produk Versi
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)

ActivateSingleton<TService>(IServiceCollection)

Source:
AutoActivationExtensions.cs

Enforces singleton activation at startup time rather than at runtime.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ActivateSingleton<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class;

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

.NET 10 (package-provided) dan versi lain
Produk Versi
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)