ServiceDescriptor 建構函式

定義

多載

ServiceDescriptor(Type, Object)

使用指定的 instance,將 ServiceDescriptor 的新執行個體初始化為 Singleton

ServiceDescriptor(Type, Func<IServiceProvider,Object>, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 factory 的新執行個體。

ServiceDescriptor(Type, Type, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 implementationType 的新執行個體。

ServiceDescriptor(Type, Object)

使用指定的 instance,將 ServiceDescriptor 的新執行個體初始化為 Singleton

public:
 ServiceDescriptor(Type ^ serviceType, System::Object ^ instance);
public ServiceDescriptor (Type serviceType, object instance);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * obj -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, instance As Object)

參數

serviceType
Type

服務的 Type

instance
Object

執行服務的執行個體。

適用於

ServiceDescriptor(Type, Func<IServiceProvider,Object>, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 factory 的新執行個體。

public:
 ServiceDescriptor(Type ^ serviceType, Func<IServiceProvider ^, System::Object ^> ^ factory, Microsoft::Extensions::DependencyInjection::ServiceLifetime lifetime);
public ServiceDescriptor (Type serviceType, Func<IServiceProvider,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * Func<IServiceProvider, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, factory As Func(Of IServiceProvider, Object), lifetime As ServiceLifetime)

參數

serviceType
Type

服務的 Type

factory
Func<IServiceProvider,Object>

用於建立服務執行個體的 Factory。

lifetime
ServiceLifetime

服務的 ServiceLifetime

適用於

ServiceDescriptor(Type, Type, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 implementationType 的新執行個體。

public:
 ServiceDescriptor(Type ^ serviceType, Type ^ implementationType, Microsoft::Extensions::DependencyInjection::ServiceLifetime lifetime);
public ServiceDescriptor (Type serviceType, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, implementationType As Type, lifetime As ServiceLifetime)

參數

serviceType
Type

服務的 Type

implementationType
Type

實作服務的 Type

lifetime
ServiceLifetime

服務的 ServiceLifetime

適用於