共用方式為


AutoActivationExtensions.AddActivatedSingleton 方法

定義

多載

AddActivatedSingleton(IServiceCollection, Type)

將 serviceType 中所指定類型的自動啟動單一服務新增至指定的 IServiceCollection

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

新增自動啟動的單一服務。

AddActivatedSingleton(IServiceCollection, Type, Type)

新增自動啟動的單一服務。

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

新增自動啟動的單一服務。

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

新增自動啟動的單一服務。

AddActivatedSingleton<TService>(IServiceCollection)

新增自動啟動的單一服務。

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

新增自動啟動的單一服務。

AddActivatedSingleton(IServiceCollection, Type)

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

將 serviceType 中所指定類型的自動啟動單一服務新增至指定的 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

參數

services
IServiceCollection

要加入服務的服務集合。

serviceType
Type

要註冊的服務類型,以及要使用的實作。

傳回

services 的值。

適用於

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

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

參數

services
IServiceCollection

要加入服務的服務集合。

serviceType
Type

要註冊的服務類型。

implementationFactory
Func<IServiceProvider,Object>

建立服務的 Factory。

傳回

services 的值。

適用於

AddActivatedSingleton(IServiceCollection, Type, Type)

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

參數

services
IServiceCollection

要加入服務的服務集合。

serviceType
Type

要註冊的服務類型。

implementationType
Type

服務的實作類型。

傳回

services 的值。

適用於

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

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

類型參數

TService

要新增的服務類型。

TImplementation

要使用的實作類型。

參數

services
IServiceCollection

要加入服務的服務集合。

implementationFactory
Func<IServiceProvider,TImplementation>

建立服務的 Factory。

傳回

services 的值。

適用於

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

類型參數

TService

要新增的服務類型。

TImplementation

要使用的實作類型。

參數

services
IServiceCollection

要加入服務的服務集合。

傳回

services 的值。

適用於

AddActivatedSingleton<TService>(IServiceCollection)

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

類型參數

TService

要新增的服務類型。

參數

services
IServiceCollection

要加入服務的服務集合。

傳回

services 的值。

適用於

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

來源:
AutoActivationExtensions.cs
來源:
AutoActivationExtensions.cs

新增自動啟動的單一服務。

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

類型參數

TService

要新增的服務類型。

參數

services
IServiceCollection

要加入服務的服務集合。

implementationFactory
Func<IServiceProvider,TService>

建立服務的 Factory。

傳回

services 的值。

適用於