ServiceDescriptor.Scoped 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Scoped(Type, Func<IServiceProvider,Object>) |
使用指定的 |
Scoped(Type, Type) |
使用指定的 |
Scoped<TService,TImplementation>(Func<IServiceProvider,TImplementation>) |
使用指定的 |
Scoped<TService,TImplementation>() |
使用指定的 |
Scoped<TService>(Func<IServiceProvider,TService>) |
使用指定的 |
Scoped(Type, Func<IServiceProvider,Object>)
使用指定的 service
、implementationFactory
和 Scoped 存留期來建立 ServiceDescriptor 的執行個體。
public:
static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Scoped(Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Scoped (Type service, Func<IServiceProvider,object> implementationFactory);
static member Scoped : Type * Func<IServiceProvider, obj> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Shared Function Scoped (service As Type, implementationFactory As Func(Of IServiceProvider, Object)) As ServiceDescriptor
參數
- service
- Type
服務的類型。
- implementationFactory
- Func<IServiceProvider,Object>
建立服務實作之新執行個體的 Factory。
傳回
ServiceDescriptor 的新執行個體。
適用於
Scoped(Type, Type)
使用指定的 service
、implementationType
和 Scoped 存留期來建立 ServiceDescriptor 的執行個體。
public:
static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Scoped(Type ^ service, Type ^ implementationType);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Scoped (Type service, Type implementationType);
static member Scoped : Type * Type -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Shared Function Scoped (service As Type, implementationType As Type) As ServiceDescriptor
參數
- service
- Type
服務的類型。
- implementationType
- Type
實作的類型。
傳回
ServiceDescriptor 的新執行個體。
適用於
Scoped<TService,TImplementation>(Func<IServiceProvider,TImplementation>)
使用指定的 TService
、TImplementation
、implementationFactory
和 Scoped 存留期來建立 ServiceDescriptor 的執行個體。
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Scoped(Func<IServiceProvider ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Scoped<TService,TImplementation> (Func<IServiceProvider,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member Scoped : Func<IServiceProvider, #'Service> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Scoped(Of TService As Class, TImplementation As Class) (implementationFactory As Func(Of IServiceProvider, TImplementation)) As ServiceDescriptor
類型參數
- TService
服務的類型。
- TImplementation
實作的類型。
參數
- implementationFactory
- Func<IServiceProvider,TImplementation>
建立服務實作之新執行個體的 Factory。
傳回
ServiceDescriptor 的新執行個體。
適用於
Scoped<TService,TImplementation>()
使用指定的 TService
、TImplementation
和 Scoped 存留期來建立 ServiceDescriptor 的執行個體。
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Scoped();
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Scoped<TService,TImplementation> () where TService : class where TImplementation : class, TService;
static member Scoped : unit -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Scoped(Of TService As Class, TImplementation As Class) () As ServiceDescriptor
類型參數
- TService
服務的類型。
- TImplementation
實作的類型。
傳回
ServiceDescriptor 的新執行個體。
適用於
Scoped<TService>(Func<IServiceProvider,TService>)
使用指定的 TService
、implementationFactory
和 Scoped 存留期來建立 ServiceDescriptor 的執行個體。
public:
generic <typename TService>
where TService : class static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Scoped(Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Scoped<TService> (Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member Scoped : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Scoped(Of TService As Class) (implementationFactory As Func(Of IServiceProvider, TService)) As ServiceDescriptor
類型參數
- TService
服務的類型。
參數
- implementationFactory
- Func<IServiceProvider,TService>
建立服務實作之新執行個體的 Factory。
傳回
ServiceDescriptor 的新執行個體。