ServiceCollectionDescriptorExtensions.TryAddScoped Metoda

Definice

Přetížení

TryAddScoped(IServiceCollection, Type)

Pokud typ služby ještě není zaregistrovaný, přidá zadanou serviceScoped službu jako službu collection .

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

Přidá zadanou serviceScoped jako službu pomocí továrny zadané v implementationFactory do objektu collection , pokud typ služby ještě není zaregistrovaný.

TryAddScoped(IServiceCollection, Type, Type)

Přidá zadanou serviceScoped službu s implementací implementationType do collection , pokud typ služby ještě není zaregistrovaný.

TryAddScoped<TService,TImplementation>(IServiceCollection)

Přidá zadaný TServiceScoped jako typ implementace služby zadaný v TImplementation do collection pole, pokud tento typ služby ještě není zaregistrovaný.

TryAddScoped<TService>(IServiceCollection)

Pokud typ služby ještě není zaregistrovaný, přidá zadanou TServiceScoped službu jako službu collection .

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

Přidá zadanou TServiceScoped jako službu pomocí továrny zadané v implementationFactory do objektu services , pokud typ služby ještě není zaregistrovaný.

TryAddScoped(IServiceCollection, Type)

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Pokud typ služby ještě není zaregistrovaný, přidá zadanou serviceScoped službu jako službu collection .

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)

Parametry

service
Type

Typ služby, která se má zaregistrovat.

Platí pro

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

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Přidá zadanou serviceScoped jako službu pomocí továrny zadané v implementationFactory do objektu collection , pokud typ služby ještě není zaregistrovaný.

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))

Parametry

service
Type

Typ služby, která se má zaregistrovat.

implementationFactory
Func<IServiceProvider,Object>

Továrna, která vytváří službu.

Platí pro

TryAddScoped(IServiceCollection, Type, Type)

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Přidá zadanou serviceScoped službu s implementací implementationType do collection , pokud typ služby ještě není zaregistrovaný.

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)

Parametry

service
Type

Typ služby, která se má zaregistrovat.

implementationType
Type

Typ implementace služby.

Platí pro

TryAddScoped<TService,TImplementation>(IServiceCollection)

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Přidá zadaný TServiceScoped jako typ implementace služby zadaný v TImplementation do collection pole, pokud tento typ služby ještě není zaregistrovaný.

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)

Parametry typu

TService

Typ služby, která se má přidat.

TImplementation

Typ implementace, která se má použít.

Parametry

Platí pro

TryAddScoped<TService>(IServiceCollection)

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Pokud typ služby ještě není zaregistrovaný, přidá zadanou TServiceScoped službu jako službu collection .

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)

Parametry typu

TService

Typ služby, která se má přidat.

Parametry

Platí pro

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

Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs
Zdroj:
ServiceCollectionDescriptorExtensions.cs

Přidá zadanou TServiceScoped jako službu pomocí továrny zadané v implementationFactory do objektu services , pokud typ služby ještě není zaregistrovaný.

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))

Parametry typu

TService

Typ služby, která se má přidat.

Parametry

implementationFactory
Func<IServiceProvider,TService>

Továrna, která vytváří službu.

Platí pro