ServiceCollectionDescriptorExtensions.TryAddTransient Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Sobrecargas
TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Adicionará o |
TryAddTransient(IServiceCollection, Type) |
Adicionará o |
TryAddTransient(IServiceCollection, Type, Type) |
Adicionará o |
TryAddTransient<TService,TImplementation>(IServiceCollection) |
Adicionará o |
TryAddTransient<TService>(IServiceCollection) |
Adicionará o |
TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Adicionará o |
TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)
Adicionará o service
especificado como um serviço de Transient usando o alocador especificado em implementationFactory
à collection
se o tipo de serviço ainda não tiver sido registrado.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static void TryAddTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Func<IServiceProvider,object> implementationFactory);
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> unit
<Extension()>
Public Sub TryAddTransient (collection As IServiceCollection, service As Type, implementationFactory As Func(Of IServiceProvider, Object))
Parâmetros
- collection
- IServiceCollection
- service
- Type
O tipo do serviço a ser registrado.
- implementationFactory
- Func<IServiceProvider,Object>
O alocador que cria o serviço.
Aplica-se a
TryAddTransient(IServiceCollection, Type)
Adicionará o service
especificado como um serviço Transient à collection
se o tipo de serviço ainda não tiver sido registrado.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service);
public static void TryAddTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service);
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> unit
<Extension()>
Public Sub TryAddTransient (collection As IServiceCollection, service As Type)
Parâmetros
- collection
- IServiceCollection
- service
- Type
O tipo do serviço a ser registrado.
Aplica-se a
TryAddTransient(IServiceCollection, Type, Type)
Adicionará o service
especificado como um serviço Transient com a implementação de implementationType
à collection
se o tipo de serviço ainda não tiver sido registrado.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Type ^ implementationType);
public static void TryAddTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Type implementationType);
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Type -> unit
<Extension()>
Public Sub TryAddTransient (collection As IServiceCollection, service As Type, implementationType As Type)
Parâmetros
- collection
- IServiceCollection
- service
- Type
O tipo do serviço a ser registrado.
- implementationType
- Type
O tipo de implementação do serviço.
Aplica-se a
TryAddTransient<TService,TImplementation>(IServiceCollection)
Adicionará o TService
especificado como um tipo de implementação de serviço de Transient especificado em TImplementation
à collection
se o tipo de serviço ainda não tiver sido registrado.
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddTransient<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class where TImplementation : class, TService;
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddTransient(Of TService As Class, TImplementation As Class) (collection As IServiceCollection)
Parâmetros de tipo
- TService
O tipo do serviço a adicionar.
- TImplementation
O tipo da implementação a ser usada.
Parâmetros
- collection
- IServiceCollection
Aplica-se a
TryAddTransient<TService>(IServiceCollection)
Adicionará o TService
especificado como um serviço Transient à collection
se o tipo de serviço ainda não tiver sido registrado.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class;
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddTransient(Of TService As Class) (collection As IServiceCollection)
Parâmetros de tipo
- TService
O tipo do serviço a adicionar.
Parâmetros
- collection
- IServiceCollection
Aplica-se a
TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)
Adicionará o TService
especificado como um serviço de Transient usando o alocador especificado em implementationFactory
à services
se o tipo de serviço ainda não tiver sido registrado.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static void TryAddTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member TryAddTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddTransient(Of TService As Class) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, TService))
Parâmetros de tipo
- TService
O tipo do serviço a adicionar.
Parâmetros
- services
- IServiceCollection
- implementationFactory
- Func<IServiceProvider,TService>
O alocador que cria o serviço.