ServiceCollectionDescriptorExtensions.TryAddKeyedSingleton Método

Definición

Sobrecargas

TryAddKeyedSingleton(IServiceCollection, Type, Object)

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

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

Agrega a collection el objeto service especificado como servicio Singleton mediante el generador especificado en implementationFactory si el tipo de servicio todavía no se ha registrado.

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

Agrega a collection el objeto service especificado como servicio Singleton con la implementación de implementationType si el tipo de servicio todavía no se ha registrado.

TryAddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

Agrega a collection el objeto TService especificado como tipo de implementación de servicio Singleton especificado en TImplementation si el tipo de servicio todavía no se ha registrado.

TryAddKeyedSingleton<TService>(IServiceCollection, Object)

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

TryAddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

Agrega a services el objeto TService especificado como servicio Singleton mediante el generador especificado en implementationFactory si el tipo de servicio todavía no se ha registrado.

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

Agrega a collection el objeto TService especificado como servicio Singleton con una instancia especificada en instance si el tipo de servicio todavía no se ha registrado.

TryAddKeyedSingleton(IServiceCollection, Type, Object)

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

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

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey);
public static void TryAddKeyedSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey);
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> unit
<Extension()>
Public Sub TryAddKeyedSingleton (collection As IServiceCollection, service As Type, serviceKey As Object)

Parámetros

service
Type

El tipo de servicio que se va a registrar.

serviceKey
Object

Clave de servicio.

Se aplica a

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

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

Agrega a collection el objeto service especificado como servicio Singleton mediante el generador especificado en implementationFactory si el tipo de servicio todavía no se ha registrado.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static void TryAddKeyedSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> unit
<Extension()>
Public Sub TryAddKeyedSingleton (collection As IServiceCollection, service As Type, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, Object))

Parámetros

service
Type

El tipo de servicio que se va a registrar.

serviceKey
Object

Clave de servicio.

implementationFactory
Func<IServiceProvider,Object,Object>

El generador que crea el servicio.

Se aplica a

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

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

Agrega a collection el objeto service especificado como servicio Singleton con la implementación de implementationType si el tipo de servicio todavía no se ha registrado.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Type ^ implementationType);
public static void TryAddKeyedSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Type implementationType);
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> unit
<Extension()>
Public Sub TryAddKeyedSingleton (collection As IServiceCollection, service As Type, serviceKey As Object, implementationType As Type)

Parámetros

service
Type

El tipo de servicio que se va a registrar.

serviceKey
Object

Clave de servicio.

implementationType
Type

El tipo de implementación del servicio.

Se aplica a

TryAddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

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

Agrega a collection el objeto TService especificado como tipo de implementación de servicio Singleton 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 TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedSingleton<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class where TImplementation : class, TService;
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedSingleton(Of TService As Class, TImplementation As Class) (collection As IServiceCollection, serviceKey As Object)

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

El parámetro de cadena de consulta IServiceCollection.

serviceKey
Object

Clave de servicio.

Se aplica a

TryAddKeyedSingleton<TService>(IServiceCollection, Object)

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

Agrega el objeto TService especificado como servicio Singleton 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 TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class;
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedSingleton(Of TService As Class) (collection As IServiceCollection, serviceKey As Object)

Parámetros de tipo

TService

El tipo del servicio que se debe agregar.

Parámetros

serviceKey
Object

Clave de servicio.

Se aplica a

TryAddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

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

Agrega a services el objeto TService especificado como servicio Singleton 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 TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static void TryAddKeyedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedSingleton(Of TService As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TService))

Parámetros de tipo

TService

El tipo del servicio que se debe agregar.

Parámetros

serviceKey
Object

Clave de servicio.

implementationFactory
Func<IServiceProvider,Object,TService>

El generador que crea el servicio.

Se aplica a

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

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

Agrega a collection el objeto TService especificado como servicio Singleton con una instancia especificada en instance si el tipo de servicio todavía no se ha registrado.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static void TryAddKeyedSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey, TService instance);
public static void TryAddKeyedSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey, TService instance) where TService : class;
static member TryAddKeyedSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * 'Service -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedSingleton(Of TService As Class) (collection As IServiceCollection, serviceKey As Object, instance As TService)

Parámetros de tipo

TService

El tipo del servicio que se debe agregar.

Parámetros

serviceKey
Object

Clave de servicio.

instance
TService

La instancia del servicio que se va a agregar.

Se aplica a