다음을 통해 공유


ServiceCollectionServiceExtensions.AddSingleton 메서드

정의

오버로드

AddSingleton(IServiceCollection, Type, Object)

implementationInstance에 지정된 인스턴스가 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton(IServiceCollection, Type, Type)

implementationType에 지정된 형식의 구현이 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton(IServiceCollection, Type)

serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

implementationFactory에 지정된 팩터리가 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton<TService,TImplementation>(IServiceCollection)

TImplementation에 지정된 구현 형식이 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

implementationFactory에 지정된 팩터리를 사용하여 TImplementation에 지정된 구현 형식이 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton<TService>(IServiceCollection)

TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

implementationFactory에 지정된 팩터리가 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton<TService>(IServiceCollection, TService)

implementationInstance에 지정된 인스턴스가 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

AddSingleton(IServiceCollection, Type, Object)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationInstance에 지정된 인스턴스가 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

serviceType
Type

등록할 서비스의 유형입니다.

implementationInstance
Object

서비스 인스턴스입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

AddSingleton(IServiceCollection, Type, Type)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationType에 지정된 형식의 구현이 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

serviceType
Type

등록할 서비스의 유형입니다.

implementationType
Type

서비스의 구현 유형입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

AddSingleton(IServiceCollection, Type)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

serviceType에 지정된 형식의 싱글톤 서비스를 지정된 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

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

serviceType
Type

등록할 서비스의 형식과 사용할 구현입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

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

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationFactory에 지정된 팩터리가 있는 serviceType에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

serviceType
Type

등록할 서비스의 유형입니다.

implementationFactory
Func<IServiceProvider,Object>

서비스를 만드는 팩터리입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

AddSingleton<TService,TImplementation>(IServiceCollection)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

TImplementation에 지정된 구현 형식이 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 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

형식 매개 변수

TService

추가할 서비스 유형입니다.

TImplementation

사용할 구현의 형식입니다.

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

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

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationFactory에 지정된 팩터리를 사용하여 TImplementation에 지정된 구현 형식이 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 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, 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

형식 매개 변수

TService

추가할 서비스 유형입니다.

TImplementation

사용할 구현의 형식입니다.

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

implementationFactory
Func<IServiceProvider,TImplementation>

서비스를 만드는 팩터리입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

AddSingleton<TService>(IServiceCollection)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

TService에 지정된 형식의 싱글톤 서비스를 지정된 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

형식 매개 변수

TService

추가할 서비스 유형입니다.

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

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

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationFactory에 지정된 팩터리가 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

형식 매개 변수

TService

추가할 서비스 유형입니다.

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

implementationFactory
Func<IServiceProvider,TService>

서비스를 만드는 팩터리입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상

AddSingleton<TService>(IServiceCollection, TService)

Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs
Source:
ServiceCollectionServiceExtensions.cs

implementationInstance에 지정된 인스턴스가 있는 TService에 지정된 형식의 싱글톤 서비스를 지정된 IServiceCollection에 추가합니다.

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

형식 매개 변수

TService

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

implementationInstance
TService

서비스 인스턴스입니다.

반환

작업이 완료된 후 이 인스턴스에 대한 참조입니다.

추가 정보

적용 대상