AutoActivationExtensions.ActivateSingleton Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
- 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
.NET 10 (package-provided) dan versi lain
Produk | Versi |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
- 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
.NET 10 (package-provided) dan versi lain
Produk | Versi |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: