ServiceCollectionDescriptorExtensions.TryAddScoped Metode

Definisi

Overload

TryAddScoped(IServiceCollection, Type)

Menambahkan yang ditentukan service sebagai Scoped layanan ke collection jika jenis layanan belum terdaftar.

TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

Menambahkan yang ditentukan service sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactorycollection jika jenis layanan belum terdaftar.

TryAddScoped(IServiceCollection, Type, Type)

Menambahkan yang ditentukan service sebagai Scoped layanan dengan implementationType implementasi ke collection jika jenis layanan belum terdaftar.

TryAddScoped<TService,TImplementation>(IServiceCollection)

Menambahkan yang ditentukan TService sebagai jenis implementasi layanan yang Scoped ditentukan dalam TImplementation jika collection jenis layanan belum terdaftar.

TryAddScoped<TService>(IServiceCollection)

Menambahkan yang ditentukan TService sebagai Scoped layanan ke collection jika jenis layanan belum terdaftar.

TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Menambahkan yang ditentukan TService sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactoryservices jika jenis layanan belum terdaftar.

TryAddScoped(IServiceCollection, Type)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

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

service
Type

Jenis layanan yang akan didaftarkan.

Berlaku untuk

TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

Menambahkan yang ditentukan service sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactorycollection 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

service
Type

Jenis layanan yang akan didaftarkan.

implementationFactory
Func<IServiceProvider,Object>

Pabrik yang membuat layanan.

Berlaku untuk

TryAddScoped(IServiceCollection, Type, Type)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

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

service
Type

Jenis layanan yang akan didaftarkan.

implementationType
Type

Jenis implementasi layanan.

Berlaku untuk

TryAddScoped<TService,TImplementation>(IServiceCollection)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

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

Berlaku untuk

TryAddScoped<TService>(IServiceCollection)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

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

Berlaku untuk

TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)

Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs
Sumber:
ServiceCollectionDescriptorExtensions.cs

Menambahkan yang ditentukan TService sebagai Scoped layanan menggunakan pabrik yang ditentukan ke implementationFactoryservices 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

implementationFactory
Func<IServiceProvider,TService>

Pabrik yang membuat layanan.

Berlaku untuk