Compartir a través de


AutoActivationExtensions.AddActivatedSingleton Method

Definition

Overloads

AddActivatedSingleton(IServiceCollection, Type)

Adds an auto-activated singleton service of the type specified in serviceType to the specified IServiceCollection.

AddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

Adds an auto-activated singleton service.

AddActivatedSingleton(IServiceCollection, Type, Type)

Adds an auto-activated singleton service.

AddActivatedSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Adds an auto-activated singleton service.

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

Adds an auto-activated singleton service.

AddActivatedSingleton<TService>(IServiceCollection)

Adds an auto-activated singleton service.

AddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Adds an auto-activated singleton service.

AddActivatedSingleton(IServiceCollection, Type)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service of the type specified in serviceType to the specified IServiceCollection.

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

Parameters

services
IServiceCollection

The service collection to add the service to.

serviceType
Type

The type of the service to register and the implementation to use.

Returns

The value of services.

Applies to

AddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddActivatedSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, Func<IServiceProvider,object> implementationFactory);
static member AddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddActivatedSingleton (services As IServiceCollection, serviceType As Type, implementationFactory As Func(Of IServiceProvider, Object)) As IServiceCollection

Parameters

services
IServiceCollection

The service collection to add the service to.

serviceType
Type

The type of the service to register.

implementationFactory
Func<IServiceProvider,Object>

The factory that creates the service.

Returns

The value of services.

Applies to

AddActivatedSingleton(IServiceCollection, Type, Type)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

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

Parameters

services
IServiceCollection

The service collection to add the service to.

serviceType
Type

The type of the service to register.

implementationType
Type

The implementation type of the service.

Returns

The value of services.

Applies to

AddActivatedSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddActivatedSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member AddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, #'Service> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddActivatedSingleton(Of TService As Class, TImplementation As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TImplementation)) As IServiceCollection

Type Parameters

TService

The type of the service to add.

TImplementation

The type of the implementation to use.

Parameters

services
IServiceCollection

The service collection to add the service to.

implementationFactory
Func<IServiceProvider,TImplementation>

The factory that creates the service.

Returns

The value of services.

Applies to

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddActivatedSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class where TImplementation : class, TService;
static member AddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddActivatedSingleton(Of TService As Class, TImplementation As Class) (services As IServiceCollection) As IServiceCollection

Type Parameters

TService

The type of the service to add.

TImplementation

The type of the implementation to use.

Parameters

services
IServiceCollection

The service collection to add the service to.

Returns

The value of services.

Applies to

AddActivatedSingleton<TService>(IServiceCollection)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddActivatedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class;
static member AddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddActivatedSingleton(Of TService As Class) (services As IServiceCollection) As IServiceCollection

Type Parameters

TService

The type of the service to add.

Parameters

services
IServiceCollection

The service collection to add the service to.

Returns

The value of services.

Applies to

AddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Source:
AutoActivationExtensions.cs

Adds an auto-activated singleton service.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddActivatedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member AddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddActivatedSingleton(Of TService As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TService)) As IServiceCollection

Type Parameters

TService

The type of the service to add.

Parameters

services
IServiceCollection

The service collection to add the service to.

implementationFactory
Func<IServiceProvider,TService>

The factory that creates the service.

Returns

The value of services.

Applies to