Compartir a través de


ServiceCollectionDescriptorExtensions.TryAddScoped Método

Definición

Sobrecargas

TryAddScoped(IServiceCollection, Type)

Agrega el objeto service especificado como servicio Scoped a collection si el tipo de servicio todavía no se ha registrado.

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.

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.

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.

TryAddScoped<TService>(IServiceCollection)

Agrega el objeto TService especificado como servicio Scoped a collection si el tipo de servicio todavía no se ha registrado.

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.

TryAddScoped(IServiceCollection, Type)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

service
Type

El tipo de servicio que se va a registrar.

Se aplica a

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

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

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)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

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)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

Se aplica a

TryAddScoped<TService>(IServiceCollection)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

Se aplica a

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

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

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

implementationFactory
Func<IServiceProvider,TService>

El generador que crea el servicio.

Se aplica a