ServiceCollectionDescriptorExtensions.TryAddKeyedTransient Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
TryAddKeyedTransient(IServiceCollection, Type, Object, Type) |
Aggiunge l'oggetto |
TryAddKeyedTransient(IServiceCollection, Type, Object) |
Aggiunge l'oggetto |
TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>) |
Aggiunge l'oggetto |
TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object) |
Aggiunge l'oggetto |
TryAddKeyedTransient<TService>(IServiceCollection, Object) |
Aggiunge l'oggetto |
TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>) |
Aggiunge l'oggetto |
TryAddKeyedTransient(IServiceCollection, Type, Object, 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.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Type ^ implementationType);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Type implementationType);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> unit
<Extension()>
Public Sub TryAddKeyedTransient (collection As IServiceCollection, service As Type, serviceKey As Object, implementationType As Type)
Parametri
- collection
- IServiceCollection
Oggetto IServiceCollection.
- service
- Type
Tipo di servizio da registrare.
- serviceKey
- Object
Chiave di servizio.
- implementationType
- Type
Tipo di implementazione del servizio.
Si applica a
TryAddKeyedTransient(IServiceCollection, Type, Object)
Aggiunge l'oggetto service
specificato come servizio Transient a collection
se il tipo di servizio non è già stato registrato.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> unit
<Extension()>
Public Sub TryAddKeyedTransient (collection As IServiceCollection, service As Type, serviceKey As Object)
Parametri
- collection
- IServiceCollection
Oggetto IServiceCollection.
- service
- Type
Tipo di servizio da registrare.
- serviceKey
- Object
Chiave di servizio.
Si applica a
TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,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.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static void TryAddKeyedTransient (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> unit
<Extension()>
Public Sub TryAddKeyedTransient (collection As IServiceCollection, service As Type, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, Object))
Parametri
- collection
- IServiceCollection
Oggetto IServiceCollection.
- service
- Type
Tipo di servizio da registrare.
- serviceKey
- Object
Chiave di servizio.
- implementationFactory
- Func<IServiceProvider,Object,Object>
Factory che crea il servizio.
Si applica a
TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)
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.
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedTransient<TService,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class where TImplementation : class, TService;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(Of TService As Class, TImplementation As Class) (collection As IServiceCollection, serviceKey As Object)
Parametri di tipo
- TService
Tipo del servizio da aggiungere.
- TImplementation
Tipo dell'implementazione da usare.
Parametri
- collection
- IServiceCollection
Oggetto IServiceCollection.
- serviceKey
- Object
Chiave di servizio.
Si applica a
TryAddKeyedTransient<TService>(IServiceCollection, Object)
Aggiunge l'oggetto TService
specificato come servizio Transient a collection
se il tipo di servizio non è già stato registrato.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(Of TService As Class) (collection As IServiceCollection, serviceKey As Object)
Parametri di tipo
- TService
Tipo del servizio da aggiungere.
Parametri
- collection
- IServiceCollection
Oggetto IServiceCollection.
- serviceKey
- Object
Chiave di servizio.
Si applica a
TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,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.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static void TryAddKeyedTransient<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
static member TryAddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedTransient(Of TService As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TService))
Parametri di tipo
- TService
Tipo del servizio da aggiungere.
Parametri
- services
- IServiceCollection
Oggetto IServiceCollection.
- serviceKey
- Object
Chiave di servizio.
- implementationFactory
- Func<IServiceProvider,Object,TService>
Factory che crea il servizio.