ServiceCollectionDescriptorExtensions.TryAddScoped 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
TryAddScoped(IServiceCollection, Type) |
Menambahkan yang ditentukan |
TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Menambahkan yang ditentukan |
TryAddScoped(IServiceCollection, Type, Type) |
Menambahkan yang ditentukan |
TryAddScoped<TService,TImplementation>(IServiceCollection) |
Menambahkan yang ditentukan |
TryAddScoped<TService>(IServiceCollection) |
Menambahkan yang ditentukan |
TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Menambahkan yang ditentukan |
TryAddScoped(IServiceCollection, Type)
Menambahkan yang ditentukan service
sebagai Scoped layanan ke collection
jika jenis layanan belum terdaftar.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service);
public static void TryAddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> unit
<Extension()>
Public Sub TryAddScoped (collection As IServiceCollection, service As Type)
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
Berlaku untuk
TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static void TryAddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Func<IServiceProvider,object> implementationFactory);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> unit
<Extension()>
Public Sub TryAddScoped (collection As IServiceCollection, service As Type, implementationFactory As Func(Of IServiceProvider, Object))
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
- implementationFactory
- Func<IServiceProvider,Object>
Pabrik yang membuat layanan.
Berlaku untuk
TryAddScoped(IServiceCollection, Type, 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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Type ^ implementationType);
public static void TryAddScoped (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Type implementationType);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Type -> unit
<Extension()>
Public Sub TryAddScoped (collection As IServiceCollection, service As Type, implementationType As Type)
Parameter
- collection
- IServiceCollection
- service
- Type
Jenis layanan yang akan didaftarkan.
- implementationType
- Type
Jenis implementasi layanan.
Berlaku untuk
TryAddScoped<TService,TImplementation>(IServiceCollection)
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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddScoped<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class where TImplementation : class, TService;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(Of TService As Class, TImplementation As Class) (collection As IServiceCollection)
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
- TImplementation
Jenis implementasi yang akan digunakan.
Parameter
- collection
- IServiceCollection
Berlaku untuk
TryAddScoped<TService>(IServiceCollection)
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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(Of TService As Class) (collection As IServiceCollection)
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
Parameter
- collection
- IServiceCollection
Berlaku untuk
TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static void TryAddScoped<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(Of TService As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TService))
Jenis parameter
- TService
Jenis layanan yang akan ditambahkan.
Parameter
- services
- IServiceCollection
- implementationFactory
- Func<IServiceProvider,TService>
Pabrik yang membuat layanan.