ServiceCollectionDescriptorExtensions.TryAddScoped 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
TryAddScoped(IServiceCollection, Type) |
Agrega el objeto |
TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Agrega a |
TryAddScoped(IServiceCollection, Type, Type) |
Agrega a |
TryAddScoped<TService,TImplementation>(IServiceCollection) |
Agrega a |
TryAddScoped<TService>(IServiceCollection) |
Agrega el objeto |
TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Agrega a |
TryAddScoped(IServiceCollection, Type)
Agrega el objeto service
especificado como servicio Scoped a collection
si el tipo de servicio todavía no se ha registrado.
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)
Parámetros
- collection
- IServiceCollection
- service
- Type
El tipo de servicio que se va a registrar.
Se aplica a
TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)
Agrega a collection
el objeto service
especificado como servicio Scoped mediante el generador especificado en implementationFactory
si el tipo de servicio todavía no se ha registrado.
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))
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
TryAddScoped(IServiceCollection, Type, Type)
Agrega a collection
el objeto service
especificado como servicio Scoped con la implementación de implementationType
si el tipo de servicio todavía no se ha registrado.
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)
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
TryAddScoped<TService,TImplementation>(IServiceCollection)
Agrega a collection
el objeto TService
especificado como tipo de implementación de servicio Scoped 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 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)
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
TryAddScoped<TService>(IServiceCollection)
Agrega el objeto TService
especificado como servicio Scoped 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 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)
Parámetros de tipo
- TService
El tipo del servicio que se debe agregar.
Parámetros
- collection
- IServiceCollection
Se aplica a
TryAddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)
Agrega a services
el objeto TService
especificado como servicio Scoped 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 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))
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.