ServiceCollectionDescriptorExtensions.TryAddTransient Methode

Definitie

Overloads

Name Description
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.

TryAddTransient(IServiceCollection, Type)

Voegt de opgegeven service als een Transient service toe aan het collection servicetype als het servicetype nog niet is geregistreerd.

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.

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.

TryAddTransient<TService>(IServiceCollection)

Voegt de opgegeven TService als een Transient service toe aan het collection servicetype als het servicetype nog niet is geregistreerd.

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.

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

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

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)

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

service
Type

Het type service dat moet worden geregistreerd.

Zie ook

Van toepassing op

TryAddTransient(IServiceCollection, Type, Type)

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

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)

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

Zie ook

Van toepassing op

TryAddTransient<TService>(IServiceCollection)

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

Zie ook

Van toepassing op

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

Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs
Bron:
ServiceCollectionDescriptorExtensions.cs

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

implementationFactory
Func<IServiceProvider,TService>

De fabriek waarmee de service wordt gemaakt.

Zie ook

Van toepassing op