ServiceCollectionDescriptorExtensions.TryAddKeyedScoped Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Overload
TryAddKeyedScoped(IServiceCollection, Type, Object, Type) |
Menambahkan yang ditentukan |
TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>) |
Menambahkan yang ditentukan |
TryAddKeyedScoped(IServiceCollection, Type, Object) |
Menambahkan yang ditentukan |
TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object) |
Menambahkan yang ditentukan |
TryAddKeyedScoped<TService>(IServiceCollection, Object) |
Menambahkan yang ditentukan |
TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>) |
Menambahkan yang ditentukan |
TryAddKeyedScoped(IServiceCollection, Type, Object, Type)
Menambahkan yang ditentukan service
sebagai Scoped layanan dengan implementationType
implementasi ke collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Type ^ implementationType);
public static void TryAddKeyedScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Type implementationType);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object, implementationType As Type)
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
- serviceKey
- Object
Kunci layanan.
- implementationType
- Type
Jenis implementasi layanan.
Berlaku untuk
TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)
Menambahkan yang ditentukan service
sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactory
collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static void TryAddKeyedScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, Object))
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
- serviceKey
- Object
Kunci layanan.
- implementationFactory
- Func<IServiceProvider,Object,Object>
Pabrik yang membuat layanan.
Berlaku untuk
TryAddKeyedScoped(IServiceCollection, Type, Object)
Menambahkan yang ditentukan service
sebagai Scoped layanan ke collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey);
public static void TryAddKeyedScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object)
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
- serviceKey
- Object
Kunci layanan.
Berlaku untuk
TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)
Menambahkan yang ditentukan TService
sebagai jenis implementasi layanan yang Scoped ditentukan dalam TImplementation
jika collection
jenis layanan belum terdaftar.
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedScoped<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class where TImplementation : class, TService;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class, TImplementation As Class) (collection As IServiceCollection, serviceKey As Object)
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
- TImplementation
Jenis implementasi yang akan digunakan.
Parameter
- collection
- IServiceCollection
- serviceKey
- Object
Kunci layanan.
Berlaku untuk
TryAddKeyedScoped<TService>(IServiceCollection, Object)
Menambahkan yang ditentukan TService
sebagai Scoped layanan ke collection
jika jenis layanan belum terdaftar.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class) (collection As IServiceCollection, serviceKey As Object)
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
Parameter
- collection
- IServiceCollection
- serviceKey
- Object
Kunci layanan.
Berlaku untuk
TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)
Menambahkan yang ditentukan TService
sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactory
services
jika jenis layanan belum terdaftar.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static void TryAddKeyedScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TService))
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
Parameter
- services
- IServiceCollection
- serviceKey
- Object
Kunci layanan.
- implementationFactory
- Func<IServiceProvider,Object,TService>
Pabrik yang membuat layanan.