ServiceDescriptor 建構函式

定義

多載

ServiceDescriptor(Type, Object)

使用指定的 instance,將 ServiceDescriptor 的新執行個體初始化為 SingletonInitializes a new instance of ServiceDescriptor with the specified instance as a Singleton.

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

使用指定的 ServiceDescriptor,初始化 factory 的新執行個體。Initializes a new instance of ServiceDescriptor with the specified factory.

ServiceDescriptor(Type, Type, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 implementationType 的新執行個體。Initializes a new instance of ServiceDescriptor with the specified implementationType.

ServiceDescriptor(Type, Object)

使用指定的 instance,將 ServiceDescriptor 的新執行個體初始化為 SingletonInitializes a new instance of ServiceDescriptor with the specified instance as a 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

服務的 TypeThe Type of the service.

instance
Object

執行服務的執行個體。The instance implementing the service.

適用於

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

使用指定的 ServiceDescriptor,初始化 factory 的新執行個體。Initializes a new instance of ServiceDescriptor with the specified 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

服務的 TypeThe Type of the service.

factory
Func<IServiceProvider,Object>

用於建立服務執行個體的 Factory。A factory used for creating service instances.

lifetime
ServiceLifetime

服務的 ServiceLifetimeThe ServiceLifetime of the service.

適用於

ServiceDescriptor(Type, Type, ServiceLifetime)

使用指定的 ServiceDescriptor,初始化 implementationType 的新執行個體。Initializes a new instance of ServiceDescriptor with the specified 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

服務的 TypeThe Type of the service.

implementationType
Type

實作服務的 TypeThe Type implementing the service.

lifetime
ServiceLifetime

服務的 ServiceLifetimeThe ServiceLifetime of the service.

適用於