แชร์ผ่าน


AutoActivationExtensions.TryAddActivatedSingleton Method

Definition

Overloads

TryAddActivatedSingleton(IServiceCollection, Type)

Tries to add an auto-activated singleton service.

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

Tries to add an auto-activated singleton service.

TryAddActivatedSingleton(IServiceCollection, Type, Type)

Tries to add an auto-activated singleton service.

TryAddActivatedSingleton<TService,TImplementation>(IServiceCollection)

Tries to add an auto-activated singleton service.

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

Tries to add an auto-activated singleton service.

TryAddActivatedSingleton<TService>(IServiceCollection)

Tries to add an auto-activated singleton service.

TryAddActivatedSingleton(IServiceCollection, Type)

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

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

Parameters

services
IServiceCollection

The service collection to add the service to.

serviceType
Type

The type of the service to register.

Applies to

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

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

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

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.

Applies to

TryAddActivatedSingleton(IServiceCollection, Type, Type)

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

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

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.

Applies to

TryAddActivatedSingleton<TService,TImplementation>(IServiceCollection)

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static void TryAddActivatedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static void TryAddActivatedSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TService : class where TImplementation : class, TService;
static member TryAddActivatedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddActivatedSingleton(Of TService As Class, TImplementation As Class) (services 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.

Applies to

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

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

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

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.

Applies to

TryAddActivatedSingleton<TService>(IServiceCollection)

Source:
AutoActivationExtensions.cs
Source:
AutoActivationExtensions.cs

Tries to add an auto-activated singleton service.

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

Type Parameters

TService

The type of the service to add.

Parameters

services
IServiceCollection

The service collection to add the service to.

Applies to