다음을 통해 공유


ServiceCollectionDescriptorExtensions.TryAddSingleton 메서드

정의

오버로드

TryAddSingleton(IServiceCollection, Type, Type)

서비스 유형이 아직 등록되지 않은 경우 implementationType 구현을 사용하여 지정된 servicecollectionSingleton 서비스로 추가합니다.

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

서비스 유형이 아직 등록되지 않은 경우 implementationFactory에 지정된 팩터리를 사용하여 지정된 servicecollectionSingleton 서비스로 추가합니다.

TryAddSingleton(IServiceCollection, Type)

서비스 유형이 아직 등록되지 않은 경우 지정된 servicecollectionSingleton 서비스로 추가합니다.

TryAddSingleton<TService,TImplementation>(IServiceCollection)

서비스 유형이 아직 등록되지 않은 경우 지정된 TServiceTImplementation에 지정된 Singleton 서비스 구현 형식으로 collection에 추가합니다.

TryAddSingleton<TService>(IServiceCollection)

서비스 유형이 아직 등록되지 않은 경우 지정된 TServicecollectionSingleton 서비스로 추가합니다.

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

서비스 유형이 아직 등록되지 않은 경우 implementationFactory에 지정된 팩터리를 사용하여 지정된 TServiceservicesSingleton 서비스로 추가합니다.

TryAddSingleton<TService>(IServiceCollection, TService)

서비스 유형이 아직 등록되지 않은 경우 instance에 지정된 인스턴스를 사용하여 지정된 TServicecollectionSingleton 서비스로 추가합니다.

TryAddSingleton(IServiceCollection, Type, Type)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 implementationType 구현을 사용하여 지정된 servicecollectionSingleton 서비스로 추가합니다.

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

매개 변수

service
Type

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

implementationType
Type

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

적용 대상

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

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 implementationFactory에 지정된 팩터리를 사용하여 지정된 servicecollectionSingleton 서비스로 추가합니다.

public:
[System::Runtime::CompilerServices::Extension]
 static void TryAddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static void TryAddSingleton (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, Type service, Func<IServiceProvider,object> implementationFactory);
static member TryAddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * Type * Func<IServiceProvider, obj> -> unit
<Extension()>
Public Sub TryAddSingleton (collection As IServiceCollection, service As Type, implementationFactory As Func(Of IServiceProvider, Object))

매개 변수

service
Type

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

implementationFactory
Func<IServiceProvider,Object>

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

적용 대상

TryAddSingleton(IServiceCollection, Type)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 지정된 servicecollectionSingleton 서비스로 추가합니다.

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

매개 변수

service
Type

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

적용 대상

TryAddSingleton<TService,TImplementation>(IServiceCollection)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 지정된 TServiceTImplementation에 지정된 Singleton 서비스 구현 형식으로 collection에 추가합니다.

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

형식 매개 변수

TService

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

TImplementation

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

매개 변수

적용 대상

TryAddSingleton<TService>(IServiceCollection)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 지정된 TServicecollectionSingleton 서비스로 추가합니다.

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

형식 매개 변수

TService

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

매개 변수

적용 대상

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

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 implementationFactory에 지정된 팩터리를 사용하여 지정된 TServiceservicesSingleton 서비스로 추가합니다.

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

형식 매개 변수

TService

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

매개 변수

implementationFactory
Func<IServiceProvider,TService>

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

적용 대상

TryAddSingleton<TService>(IServiceCollection, TService)

Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs
Source:
ServiceCollectionDescriptorExtensions.cs

서비스 유형이 아직 등록되지 않은 경우 instance에 지정된 인스턴스를 사용하여 지정된 TServicecollectionSingleton 서비스로 추가합니다.

public:
generic <typename TService>
 where TService : class[System::Runtime::CompilerServices::Extension]
 static void TryAddSingleton(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ collection, TService instance);
public static void TryAddSingleton<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, TService instance) where TService : class;
static member TryAddSingleton : Microsoft.Extensions.DependencyInjection.IServiceCollection * 'Service -> unit (requires 'Service : null)
<Extension()>
Public Sub TryAddSingleton(Of TService As Class) (collection As IServiceCollection, instance As TService)

형식 매개 변수

TService

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

매개 변수

instance
TService

추가할 서비스의 인스턴스입니다.

적용 대상