ServiceCollectionDescriptorExtensions.TryAddKeyedTransient 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
TryAddKeyedTransient(IServiceCollection, Type, Object, Type) |
Menambahkan yang ditentukan |
TryAddKeyedTransient(IServiceCollection, Type, Object) |
Menambahkan yang ditentukan |
TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>) |
Menambahkan yang ditentukan |
TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object) |
Menambahkan yang ditentukan |
TryAddKeyedTransient<TService>(IServiceCollection, Object) |
Menambahkan yang ditentukan |
TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>) |
Menambahkan yang ditentukan |
TryAddKeyedTransient(IServiceCollection, Type, Object, Type)
Menambahkan yang ditentukan service
sebagai Transient layanan dengan implementationType
implementasi ke collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Type ^ implementationType);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Type implementationType);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> unit
<Extension()>
Public Sub TryAddKeyedTransient (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
TryAddKeyedTransient(IServiceCollection, Type, Object)
Menambahkan yang ditentukan service
sebagai Transient layanan ke collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> unit
<Extension()>
Public Sub TryAddKeyedTransient (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
TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)
Menambahkan yang ditentukan service
sebagai Transient layanan menggunakan pabrik yang ditentukan ke implementationFactory
collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> unit
<Extension()>
Public Sub TryAddKeyedTransient (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
TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)
Menambahkan yang ditentukan TService
sebagai jenis implementasi layanan yang Transient ditentukan ke TImplementation
collection
jika jenis layanan belum terdaftar.
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedTransient<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class where TImplementation : class, TService;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(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
TryAddKeyedTransient<TService>(IServiceCollection, Object)
Menambahkan yang ditentukan TService
sebagai Transient layanan ke collection
jika jenis layanan belum terdaftar.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(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
TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)
Menambahkan yang ditentukan TService
sebagai Transient 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 TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static void TryAddKeyedTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(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.