Sdílet prostřednictvím


ServiceCollectionServiceExtensions.AddSingleton Metoda

Definice

Přetížení

AddSingleton(IServiceCollection, Type, Object)

Přidá jednoúčelovou službu typu zadaného v serviceType s instancí zadanou v implementationInstance do zadaného IServiceCollectionobjektu .

AddSingleton(IServiceCollection, Type, Type)

Přidá jednoúčelovou službu typu zadaného v serviceType s implementací typu zadaného v implementationType do zadaného IServiceCollectionobjektu .

AddSingleton(IServiceCollection, Type)

Přidá jednoúčelovou službu typu zadaného v serviceType k zadanému IServiceCollection.

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

Přidá jednoúčelovou službu typu zadaného v serviceType s objektem factory zadaným v implementationFactory do zadaného IServiceCollectionobjektu .

AddSingleton<TService,TImplementation>(IServiceCollection)

Přidá jednoúčelovou službu typu zadaného v TService s typem implementace zadaným v TImplementation do zadaného IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Přidá jednoúčelovou službu typu zadaného v TService s typem implementace zadaným v TImplementation pomocí objektu factory zadaného v implementationFactory do zadaného IServiceCollectionobjektu .

AddSingleton<TService>(IServiceCollection)

Přidá jednoúčelovou službu typu zadaného v TService k zadanému IServiceCollection.

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

Přidá jednoúčelovou službu typu zadaného v TService s objektem factory zadaným v implementationFactory do zadaného IServiceCollectionobjektu .

AddSingleton<TService>(IServiceCollection, TService)

Přidá jednoúčelovou službu typu zadaného v TService s instancí zadanou v implementationInstance do zadaného IServiceCollectionobjektu .

AddSingleton(IServiceCollection, Type, Object)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v serviceType s instancí zadanou v implementationInstance do zadaného IServiceCollectionobjektu .

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

serviceType
Type

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

implementationInstance
Object

Instance služby.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton(IServiceCollection, Type, Type)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v serviceType s implementací typu zadaného v implementationType do zadaného IServiceCollectionobjektu .

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

serviceType
Type

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

implementationType
Type

Typ implementace služby.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton(IServiceCollection, Type)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v serviceType k zadanému IServiceCollection.

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

serviceType
Type

Typ služby, která se má zaregistrovat, a implementace, která se má použít.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

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

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v serviceType s objektem factory zadaným v implementationFactory do zadaného IServiceCollectionobjektu .

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

serviceType
Type

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

implementationFactory
Func<IServiceProvider,Object>

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

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton<TService,TImplementation>(IServiceCollection)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v TService s typem implementace zadaným v TImplementation do zadaného IServiceCollection.

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

Parametry typu

TService

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

TImplementation

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v TService s typem implementace zadaným v TImplementation pomocí objektu factory zadaného v implementationFactory do zadaného IServiceCollectionobjektu .

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

Parametry typu

TService

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

TImplementation

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

implementationFactory
Func<IServiceProvider,TImplementation>

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

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton<TService>(IServiceCollection)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v TService k zadanému IServiceCollection.

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

Parametry typu

TService

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

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

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v TService s objektem factory zadaným v implementationFactory do zadaného IServiceCollectionobjektu .

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

Parametry typu

TService

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

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

implementationFactory
Func<IServiceProvider,TService>

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

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro

AddSingleton<TService>(IServiceCollection, TService)

Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs
Zdroj:
ServiceCollectionServiceExtensions.cs

Přidá jednoúčelovou službu typu zadaného v TService s instancí zadanou v implementationInstance do zadaného IServiceCollectionobjektu .

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

Parametry typu

TService

Parametry

services
IServiceCollection

Chcete-li IServiceCollection přidat službu do.

implementationInstance
TService

Instance služby.

Návraty

Odkaz na tuto instanci po dokončení operace.

Viz také

Platí pro