ServiceCollectionDescriptorExtensions.TryAddTransient Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Sobrecargas
TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Agrega a |
TryAddTransient(IServiceCollection, Type) |
Agrega el objeto |
TryAddTransient(IServiceCollection, Type, Type) |
Agrega a |
TryAddTransient<TService,TImplementation>(IServiceCollection) |
Agrega a |
TryAddTransient<TService>(IServiceCollection) |
Agrega el objeto |
TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Agrega a |
TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)
Agrega a collection
el objeto service
especificado como servicio Transient mediante el generador especificado en implementationFactory
si el tipo de servicio todavía no se ha 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
El tipo de servicio que se va a registrar.
- implementationFactory
- Func<IServiceProvider,Object>
El generador que crea el servicio.
Se aplica a
TryAddTransient(IServiceCollection, Type)
Agrega el objeto service
especificado como servicio Transient a collection
si el tipo de servicio todavía no se ha 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
El tipo de servicio que se va a registrar.
Se aplica a
TryAddTransient(IServiceCollection, Type, Type)
Agrega a collection
el objeto service
especificado como servicio Transient con la implementación de implementationType
si el tipo de servicio todavía no se ha 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
El tipo de servicio que se va a registrar.
- implementationType
- Type
El tipo de implementación del servicio.
Se aplica a
TryAddTransient<TService,TImplementation>(IServiceCollection)
Agrega a collection
el objeto TService
especificado como tipo de implementación de servicio Transient especificado en TImplementation
si el tipo de servicio todavía no se ha 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
El tipo del servicio que se debe agregar.
- TImplementation
Tipo de la implementación que se va a usar.
Parámetros
- collection
- IServiceCollection
Se aplica a
TryAddTransient<TService>(IServiceCollection)
Agrega el objeto TService
especificado como servicio Transient a collection
si el tipo de servicio todavía no se ha 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
El tipo del servicio que se debe agregar.
Parámetros
- collection
- IServiceCollection
Se aplica a
TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)
Agrega a services
el objeto TService
especificado como servicio Transient mediante el generador especificado en implementationFactory
si el tipo de servicio todavía no se ha 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
El tipo del servicio que se debe agregar.
Parámetros
- services
- IServiceCollection
- implementationFactory
- Func<IServiceProvider,TService>
El generador que crea el servicio.