ServiceCollectionServiceExtensions.AddKeyedTransient Metod

Definition

Överlagringar

Name Description
AddKeyedTransient(IServiceCollection, Type, Object, Type)

Lägger till en tillfällig tjänst av den typ som anges i serviceType med en implementering av den typ som anges i implementationType till den angivna IServiceCollection.

AddKeyedTransient(IServiceCollection, Type, Object)

Lägger till en tillfällig tjänst av den typ som anges i serviceType till den angivna IServiceCollection.

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

Lägger till en tillfällig tjänst av den typ som anges i serviceType med en fabrik som anges i implementationFactory till den angivna IServiceCollection.

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

Lägger till en tillfällig tjänst av den typ som anges i TService med en implementeringstyp som anges i TImplementation till den angivna IServiceCollection.

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

Lägger till en tillfällig tjänst av den typ som anges i TService med en implementeringstyp som anges i TImplementation med hjälp av den fabrik som anges i implementationFactory till den angivna IServiceCollection.

AddKeyedTransient<TService>(IServiceCollection, Object)

Lägger till en tillfällig tjänst av den typ som anges i TService till den angivna IServiceCollection.

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

Lägger till en tillfällig tjänst av den typ som anges i TService med en fabrik som anges i implementationFactory till den angivna IServiceCollection.

AddKeyedTransient(IServiceCollection, Type, Object, Type)

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i serviceType med en implementering av den typ som anges i implementationType till den angivna IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, System::Object ^ serviceKey, Type ^ implementationType);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object? serviceKey, Type implementationType);
static member AddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddKeyedTransient (services As IServiceCollection, serviceType As Type, serviceKey As Object, implementationType As Type) As IServiceCollection

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceType
Type

Vilken typ av tjänst som ska registreras.

serviceKey
Object

Tjänstens ServiceKey .

implementationType
Type

Implementeringstypen för tjänsten.

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

AddKeyedTransient(IServiceCollection, Type, Object)

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i serviceType till den angivna IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, System::Object ^ serviceKey);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object? serviceKey);
static member AddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddKeyedTransient (services As IServiceCollection, serviceType As Type, serviceKey As Object) As IServiceCollection

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceType
Type

Vilken typ av tjänst som ska registreras och vilken implementering som ska användas.

serviceKey
Object

Tjänstens ServiceKey .

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

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

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i serviceType med en fabrik som anges i implementationFactory till den angivna IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Type ^ serviceType, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type serviceType, object? serviceKey, Func<IServiceProvider,object,object> implementationFactory);
static member AddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddKeyedTransient (services As IServiceCollection, serviceType As Type, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, Object)) As IServiceCollection

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceType
Type

Vilken typ av tjänst som ska registreras.

serviceKey
Object

Tjänstens ServiceKey .

implementationFactory
Func<IServiceProvider,Object,Object>

Fabriken som skapar tjänsten.

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i TService med en implementeringstyp som anges i TImplementation till den angivna IServiceCollection.

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

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

TImplementation

Vilken typ av implementering som ska användas.

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceKey
Object

Tjänstens ServiceKey .

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i TService med en implementeringstyp som anges i TImplementation med hjälp av den fabrik som anges i implementationFactory till den angivna IServiceCollection.

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient<TService,TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient<TService,TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member AddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, #'Service> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddKeyedTransient(Of TService As Class, TImplementation As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TImplementation)) As IServiceCollection

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

TImplementation

Vilken typ av implementering som ska användas.

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceKey
Object

Tjänstens ServiceKey .

implementationFactory
Func<IServiceProvider,Object,TImplementation>

Fabriken som skapar tjänsten.

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

AddKeyedTransient<TService>(IServiceCollection, Object)

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i TService till den angivna IServiceCollection.

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

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceKey
Object

Tjänstens ServiceKey .

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för

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

Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs
Källa:
ServiceCollectionServiceExtensions.Keyed.cs

Lägger till en tillfällig tjänst av den typ som anges i TService med en fabrik som anges i implementationFactory till den angivna IServiceCollection.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddKeyedTransient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddKeyedTransient<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object,TService> implementationFactory) where TService : class;
static member AddKeyedTransient : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddKeyedTransient(Of TService As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TService)) As IServiceCollection

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

Parametrar

services
IServiceCollection

Att IServiceCollection lägga till tjänsten i.

serviceKey
Object

Tjänstens ServiceKey .

implementationFactory
Func<IServiceProvider,Object,TService>

Fabriken som skapar tjänsten.

Returer

En referens till den här instansen när åtgärden har slutförts.

Kommentarer

Den här metoden lägger alltid till en ny registrering i IServiceCollection, även om en tjänst av samma typ och nyckel redan har registrerats. När det finns flera registreringar för samma typ och nyckel GetKeyedService<T>(IServiceProvider, Object) returnerar den senast registrerade tjänsten. Använd GetKeyedServices<T>(IServiceProvider, Object) för att hämta alla registrerade tjänster.

Se även

Gäller för