ServiceCollectionDescriptorExtensions.TryAddTransient Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Overloads
| Name | Description |
|---|---|
| TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>) |
Voegt de opgegeven |
| TryAddTransient(IServiceCollection, Type) |
Voegt de opgegeven |
| TryAddTransient(IServiceCollection, Type, Type) |
Voegt de opgegeven |
| TryAddTransient<TService,TImplementation>(IServiceCollection) |
Voegt het opgegeven |
| TryAddTransient<TService>(IServiceCollection) |
Voegt de opgegeven |
| TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>) |
Voegt de opgegeven |
TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)
Voegt de opgegeven service als een Transient service toe met behulp van de fabriek die is opgegeven in implementationFactory de collection als het servicetype nog niet is geregistreerd.
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))
Parameters
- collection
- IServiceCollection
- service
- Type
Het type service dat moet worden geregistreerd.
- implementationFactory
- Func<IServiceProvider,Object>
De fabriek waarmee de service wordt gemaakt.
Zie ook
Van toepassing op
TryAddTransient(IServiceCollection, Type)
Voegt de opgegeven service als een Transient service toe aan het collection servicetype als het servicetype nog niet is geregistreerd.
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)
Parameters
- collection
- IServiceCollection
- service
- Type
Het type service dat moet worden geregistreerd.
Zie ook
Van toepassing op
TryAddTransient(IServiceCollection, Type, Type)
Voegt de opgegeven service als een Transient service met de implementationType implementatie toe aan de collection als het servicetype nog niet is geregistreerd.
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)
Parameters
- collection
- IServiceCollection
- service
- Type
Het type service dat moet worden geregistreerd.
- implementationType
- Type
Het implementatietype van de service.
Zie ook
Van toepassing op
TryAddTransient<TService,TImplementation>(IServiceCollection)
Voegt het opgegeven TService als een Transient service-implementatietype toe dat is opgegeven in TImplementation de collection als het servicetype nog niet is geregistreerd.
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)
Type parameters
- TService
Het type service dat moet worden toegevoegd.
- TImplementation
Het type implementatie dat moet worden gebruikt.
Parameters
- collection
- IServiceCollection
Zie ook
Van toepassing op
TryAddTransient<TService>(IServiceCollection)
Voegt de opgegeven TService als een Transient service toe aan het collection servicetype als het servicetype nog niet is geregistreerd.
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)
Type parameters
- TService
Het type service dat moet worden toegevoegd.
Parameters
- collection
- IServiceCollection
Zie ook
Van toepassing op
TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)
Voegt de opgegeven TService als een Transient service toe met behulp van de fabriek die is opgegeven in implementationFactory de services als het servicetype nog niet is geregistreerd.
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))
Type parameters
- TService
Het type service dat moet worden toegevoegd.
Parameters
- services
- IServiceCollection
- implementationFactory
- Func<IServiceProvider,TService>
De fabriek waarmee de service wordt gemaakt.