ServiceCollectionDescriptorExtensions.TryAddScoped Methode

Definitie

Overloads

Name Description
TryAddScoped(IServiceCollection, Type)

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

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

Voegt de opgegeven service als een Scoped service toe met behulp van de fabriek die is opgegeven in implementationFactory de collection als het servicetype nog niet is geregistreerd.

TryAddScoped(IServiceCollection, Type, Type)

Voegt de opgegeven service als een Scoped service met de implementationType implementatie toe aan de collection als het servicetype nog niet is geregistreerd.

TryAddScoped<TService,TImplementation>(IServiceCollection)

Voegt het opgegeven TService als een Scoped service-implementatietype toe dat is opgegeven in TImplementation de collection als het servicetype nog niet is geregistreerd.

TryAddScoped<TService>(IServiceCollection)

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

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

Voegt de opgegeven TService als een Scoped service toe met behulp van de fabriek die is opgegeven in implementationFactory de services als het servicetype nog niet is geregistreerd.

TryAddScoped(IServiceCollection, Type)

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

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

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service);
public static void TryAddScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type -> unit
<Extension()>
Public Sub TryAddScoped (collection As IServiceCollection, service As Type)

Parameters

service
Type

Het type service dat moet worden geregistreerd.

Zie ook

Van toepassing op

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

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

Voegt de opgegeven service als een Scoped 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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static void TryAddScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Func<IServiceProvider,object> implementationFactory);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> unit
<Extension()>
Public Sub TryAddScoped (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

TryAddScoped(IServiceCollection, Type, Type)

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

Voegt de opgegeven service als een Scoped service met de implementationType implementatie toe aan de collection als het servicetype nog niet is geregistreerd.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Type ^ implementationType);
public static void TryAddScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Type implementationType);
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Type -> unit
<Extension()>
Public Sub TryAddScoped (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

TryAddScoped<TService,TImplementation>(IServiceCollection)

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

Voegt het opgegeven TService als een Scoped 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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddScoped<TService,TImplementation>(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class where TImplementation : class, TService;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(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

TryAddScoped<TService>(IServiceCollection)

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

Voegt de opgegeven TService als een Scoped 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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection);
public static void TryAddScoped<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection collection) where TService : class;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(Of TService As Class) (collection As IServiceCollection)

Type parameters

TService

Het type service dat moet worden toegevoegd.

Parameters

Zie ook

Van toepassing op

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

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

Voegt de opgegeven TService als een Scoped 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 TryAddScoped(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, TService> ^ implementationFactory);
public static void TryAddScoped<TService>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member TryAddScoped : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'Service (requires 'Service : null)> -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddScoped(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