ServiceCollectionDescriptorExtensions.TryAddScoped Méthode

Définition

Surcharges

TryAddScoped(IServiceCollection, Type)

Ajoute le service spécifié en tant que service Scoped au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service to the collection if the service type hasn't already been registered.

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

Ajoute le service spécifié en tant que service Scoped à l’aide de la fabrique spécifiée dans implementationFactory au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddScoped(IServiceCollection, Type, Type)

Ajoute le service spécifié en tant que service Scoped avec l’implémentation implementationType au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddScoped<TService,TImplementation>(IServiceCollection)

Ajoute le TService spécifié en tant que service Scoped à l’aide du type d’implémentation spécifié dans TImplementation au collection si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

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

Ajoute le TService spécifié en tant que service Scoped à l’aide de la fabrique spécifiée dans implementationFactory au services si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddScoped<TService>(IServiceCollection)

Ajoute le TService spécifié en tant que service Scoped au collection si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service to the collection if the service type hasn't already been registered.

TryAddScoped(IServiceCollection, Type)

Ajoute le service spécifié en tant que service Scoped au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service to the collection if the service type hasn't already been registered.

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)

Paramètres

service
Type

Type de service à inscrire.The type of the service to register.

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

Ajoute le service spécifié en tant que service Scoped à l’aide de la fabrique spécifiée dans implementationFactory au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

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))

Paramètres

service
Type

Type de service à inscrire.The type of the service to register.

implementationFactory
Func<IServiceProvider,Object>

Fabrique qui crée le service.The factory that creates the service.

TryAddScoped(IServiceCollection, Type, Type)

Ajoute le service spécifié en tant que service Scoped avec l’implémentation implementationType au collection si le type de service n’a pas déjà été inscrit.Adds the specified service as a Scoped service with the implementationType implementation to the collection if the service type hasn't already been registered.

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)

Paramètres

service
Type

Type de service à inscrire.The type of the service to register.

implementationType
Type

Type d’implémentation du service.The implementation type of the service.

TryAddScoped<TService,TImplementation>(IServiceCollection)

Ajoute le TService spécifié en tant que service Scoped à l’aide du type d’implémentation spécifié dans TImplementation au collection si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

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)

Paramètres de type

TService

Le type de service à ajouter.The type of the service to add.

TImplementation

Type de l’implémentation à utiliser.The type of the implementation to use.

Paramètres

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

Ajoute le TService spécifié en tant que service Scoped à l’aide de la fabrique spécifiée dans implementationFactory au services si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

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))

Paramètres de type

TService

Le type de service à ajouter.The type of the service to add.

Paramètres

implementationFactory
Func<IServiceProvider,TService>

Fabrique qui crée le service.The factory that creates the service.

TryAddScoped<TService>(IServiceCollection)

Ajoute le TService spécifié en tant que service Scoped au collection si le type de service n’a pas déjà été inscrit.Adds the specified TService as a Scoped service to the collection if the service type hasn't already been registered.

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)

Paramètres de type

TService

Le type de service à ajouter.The type of the service to add.

Paramètres

S’applique à