ServiceCollectionDescriptorExtensions.TryAddKeyedScoped Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| TryAddKeyedScoped(IServiceCollection, Type, Object, Type) |
Lägger till den angivna |
| TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>) |
Lägger till den angivna |
| TryAddKeyedScoped(IServiceCollection, Type, Object) |
Lägger till den angivna |
| TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object) |
Lägger till den angivna |
| TryAddKeyedScoped<TService>(IServiceCollection, Object) |
Lägger till den angivna |
| TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>) |
Lägger till den angivna |
TryAddKeyedScoped(IServiceCollection, Type, Object, Type)
Lägger till den angivna service som en Scoped tjänst med implementeringen implementationType till collection om tjänsttypen inte redan har registrerats.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Type ^ implementationType);
public static void TryAddKeyedScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Type implementationType);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Type -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object, implementationType As Type)
Parametrar
- collection
- IServiceCollection
- service
- Type
Vilken typ av tjänst som ska registreras.
- serviceKey
- Object
Tjänstnyckeln.
- implementationType
- Type
Implementeringstypen för tjänsten.
Se även
Gäller för
TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)
Lägger till den angivna service som en Scoped tjänst med den fabrik som anges i implementationFactorycollection i om tjänsttypen inte redan har registrerats.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, System::Object ^> ^ implementationFactory);
public static void TryAddKeyedScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object?,object> implementationFactory);
public static void TryAddKeyedScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey, Func<IServiceProvider,object,object> implementationFactory);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj * Func<IServiceProvider, obj, obj> -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, Object))
Parametrar
- collection
- IServiceCollection
- service
- Type
Vilken typ av tjänst som ska registreras.
- serviceKey
- Object
Tjänstnyckeln.
- implementationFactory
- Func<IServiceProvider,Object,Object>
Fabriken som skapar tjänsten.
Se även
Gäller för
TryAddKeyedScoped(IServiceCollection, Type, Object)
Lägger till den angivna service som en Scoped tjänst i collection om tjänsttypen inte redan har registrerats.
public:
[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, System::Object ^ serviceKey);
public static void TryAddKeyedScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, object? serviceKey);
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * obj -> unit
<Extension()>
Public Sub TryAddKeyedScoped (collection As IServiceCollection, service As Type, serviceKey As Object)
Parametrar
- collection
- IServiceCollection
- service
- Type
Vilken typ av tjänst som ska registreras.
- serviceKey
- Object
Tjänstnyckeln.
Se även
Gäller för
TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)
Lägger till den angivna TService som en Scoped tjänstimplementeringstyp som anges i TImplementationcollection om tjänsttypen inte redan har registrerats.
public:
generic <typename TService, typename TImplementation>
where TService : class where TImplementation : class, TService[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedScoped<TService,TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class where TImplementation : class, TService;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class, TImplementation As Class) (collection As IServiceCollection, serviceKey As Object)
Typparametrar
- TService
Vilken typ av tjänst som ska läggas till.
- TImplementation
Vilken typ av implementering som ska användas.
Parametrar
- collection
- IServiceCollection
- serviceKey
- Object
Tjänstnyckeln.
Se även
Gäller för
TryAddKeyedScoped<TService>(IServiceCollection, Object)
Lägger till den angivna TService som en Scoped tjänst i collection om tjänsttypen inte redan har registrerats.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, System::Object ^ serviceKey);
public static void TryAddKeyedScoped<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, object? serviceKey) where TService : class;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class) (collection As IServiceCollection, serviceKey As Object)
Typparametrar
- TService
Vilken typ av tjänst som ska läggas till.
Parametrar
- collection
- IServiceCollection
- serviceKey
- Object
Tjänstnyckeln.
Se även
Gäller för
TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)
Lägger till den angivna TService som en Scoped tjänst med den fabrik som anges i implementationFactoryservices i om tjänsttypen inte redan har registrerats.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static void TryAddKeyedScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::Object ^ serviceKey, Func<IServiceProvider ^, System::Object ^, TService> ^ implementationFactory);
public static void TryAddKeyedScoped<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object?,TService> implementationFactory) where TService : class;
public static void TryAddKeyedScoped<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, Func<IServiceProvider,object,TService> implementationFactory) where TService : class;
static member TryAddKeyedScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, obj, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddKeyedScoped(Of TService As Class) (services As IServiceCollection, serviceKey As Object, implementationFactory As Func(Of IServiceProvider, Object, TService))
Typparametrar
- TService
Vilken typ av tjänst som ska läggas till.
Parametrar
- services
- IServiceCollection
- serviceKey
- Object
Tjänstnyckeln.
- implementationFactory
- Func<IServiceProvider,Object,TService>
Fabriken som skapar tjänsten.