ServiceDescriptor 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ServiceDescriptor(Type, Object) |
使用指定的 |
ServiceDescriptor(Type, Func<IServiceProvider,Object>, ServiceLifetime) |
使用指定的 ServiceDescriptor,初始化 |
ServiceDescriptor(Type, Object, Object) |
使用指定的 |
ServiceDescriptor(Type, Type, ServiceLifetime) |
使用指定的 ServiceDescriptor,初始化 |
ServiceDescriptor(Type, Object, Func<IServiceProvider,Object,Object>, ServiceLifetime) |
使用指定的 ServiceDescriptor,初始化 |
ServiceDescriptor(Type, Object, Type, ServiceLifetime) |
使用指定的 ServiceDescriptor,初始化 |
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)
參數
- 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)
參數
- factory
- Func<IServiceProvider,Object>
用於建立服務執行個體的 Factory。
- lifetime
- ServiceLifetime
服務的 ServiceLifetime。
適用於
ServiceDescriptor(Type, Object, Object)
使用指定的 instance
,將 ServiceDescriptor 的新執行個體初始化為 Singleton。
public:
ServiceDescriptor(Type ^ serviceType, System::Object ^ serviceKey, System::Object ^ instance);
public ServiceDescriptor (Type serviceType, object? serviceKey, object instance);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * obj * obj -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, serviceKey As Object, instance As Object)
參數
- serviceKey
- Object
服務的 ServiceKey。
- instance
- Object
執行服務的執行個體。
適用於
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)
參數
- lifetime
- ServiceLifetime
服務的 ServiceLifetime。
適用於
ServiceDescriptor(Type, Object, Func<IServiceProvider,Object,Object>, ServiceLifetime)
使用指定的 ServiceDescriptor,初始化 factory
的新執行個體。
public:
ServiceDescriptor(Type ^ serviceType, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ factory, Microsoft::Extensions::DependencyInjection::ServiceLifetime lifetime);
public ServiceDescriptor (Type serviceType, object? serviceKey, Func<IServiceProvider,object?,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * obj * Func<IServiceProvider, obj, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, serviceKey As Object, factory As Func(Of IServiceProvider, Object, Object), lifetime As ServiceLifetime)
參數
- serviceKey
- Object
服務的 ServiceKey。
- factory
- Func<IServiceProvider,Object,Object>
用於建立服務執行個體的 Factory。
- lifetime
- ServiceLifetime
服務的 ServiceLifetime。
適用於
ServiceDescriptor(Type, Object, Type, ServiceLifetime)
使用指定的 ServiceDescriptor,初始化 implementationType
的新執行個體。
public:
ServiceDescriptor(Type ^ serviceType, System::Object ^ serviceKey, Type ^ implementationType, Microsoft::Extensions::DependencyInjection::ServiceLifetime lifetime);
public ServiceDescriptor (Type serviceType, object? serviceKey, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
new Microsoft.Extensions.DependencyInjection.ServiceDescriptor : Type * obj * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Sub New (serviceType As Type, serviceKey As Object, implementationType As Type, lifetime As ServiceLifetime)
參數
- serviceKey
- Object
服務的 ServiceKey。
- lifetime
- ServiceLifetime
服務的 ServiceLifetime。