ServiceCollectionDescriptorExtensions.TryAddTransient Metodo

Definizione

Overload

TryAddTransient(IServiceCollection, Type)

Aggiunge l'oggetto service specificato come servizio Transient a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient service to the collection if the service type hasn't already been registered.

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

Aggiunge l'oggetto service specificato come servizio Transient usando la factory specificata in implementationFactory a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type, Type)

Aggiunge l'oggetto service specificato come servizio Transient con l'implementazione di implementationType a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddTransient<TService,TImplementation>(IServiceCollection)

Aggiunge l'oggetto TService specificato come tipo di implementazione del servizio Transient specificato in TImplementation a collection se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

TryAddTransient<TService>(IServiceCollection)

Aggiunge l'oggetto TService specificato come servizio Transient a collection se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient service to the collection if the service type hasn't already been registered.

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

Aggiunge l'oggetto TService specificato come servizio Transient usando la factory specificata in implementationFactory a services se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type)

Aggiunge l'oggetto service specificato come servizio Transient a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient service to the collection if the service type hasn't already been registered.

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)

Parametri

service
Type

Tipo di servizio da registrare.The type of the service to register.

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

Aggiunge l'oggetto service specificato come servizio Transient usando la factory specificata in implementationFactory a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient 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 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))

Parametri

service
Type

Tipo di servizio da registrare.The type of the service to register.

implementationFactory
Func<IServiceProvider,Object>

Factory che crea il servizio.The factory that creates the service.

TryAddTransient(IServiceCollection, Type, Type)

Aggiunge l'oggetto service specificato come servizio Transient con l'implementazione di implementationType a collection se il tipo di servizio non è già stato registrato.Adds the specified service as a Transient service with the implementationType implementation to the collection if the service type hasn't already been registered.

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)

Parametri

service
Type

Tipo di servizio da registrare.The type of the service to register.

implementationType
Type

Tipo di implementazione del servizio.The implementation type of the service.

TryAddTransient<TService,TImplementation>(IServiceCollection)

Aggiunge l'oggetto TService specificato come tipo di implementazione del servizio Transient specificato in TImplementation a collection se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient 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 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)

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

TImplementation

Tipo di implementazione da utilizzare.The type of the implementation to use.

Parametri

TryAddTransient<TService>(IServiceCollection)

Aggiunge l'oggetto TService specificato come servizio Transient a collection se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient 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 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)

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

Parametri

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

Aggiunge l'oggetto TService specificato come servizio Transient usando la factory specificata in implementationFactory a services se il tipo di servizio non è già stato registrato.Adds the specified TService as a Transient 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 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))

Parametri di tipo

TService

Tipo del servizio da aggiungere.The type of the service to add.

Parametri

implementationFactory
Func<IServiceProvider,TService>

Factory che crea il servizio.The factory that creates the service.

Si applica a