ServiceCollectionDescriptorExtensions.TryAddSingleton Yöntem

Tanım

Aşırı Yüklemeler

TryAddSingleton(IServiceCollection, Type, Type)

Hizmet türü henüz kaydedilmemişse uygulamasıyla belirtilen implementationTypecollection hizmet olarak Singleton değerini service ekler.

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

service Hizmet türü henüz kaydedilmemişse içinde implementationFactory belirtilen fabrikayı collection kullanarak belirtilen hizmet olarak Singleton değerini ekler.

TryAddSingleton(IServiceCollection, Type)

Hizmet servicecollection türü henüz kaydedilmemişse, belirtilen hizmet olarak Singleton öğesini öğesine ekler.

TryAddSingleton<TService,TImplementation>(IServiceCollection)

Belirtilen TService hizmet türü önceden kaydedilmemişse içinde belirtilen TImplementationcollection hizmet uygulama türü olarak Singleton öğesini ekler.

TryAddSingleton<TService>(IServiceCollection)

Hizmet TServicecollection türü henüz kaydedilmemişse, belirtilen hizmet olarak Singleton öğesini öğesine ekler.

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

TService Hizmet türü henüz kaydedilmemişse içinde implementationFactory belirtilen fabrikayı services kullanarak belirtilen hizmet olarak Singleton değerini ekler.

TryAddSingleton<TService>(IServiceCollection, TService)

Hizmet TServiceSingleton türü henüz kaydedilmemişse içinde belirtilen instancecollection örneğiyle belirtilen hizmeti olarak ekler.

TryAddSingleton(IServiceCollection, Type, Type)

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

Hizmet türü henüz kaydedilmemişse uygulamasıyla belirtilen implementationTypecollection hizmet olarak Singleton değerini service ekler.

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)

Parametreler

service
Type

Kaydedilecek hizmetin türü.

implementationType
Type

Hizmetin uygulama türü.

Şunlara uygulanır

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

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

service Hizmet türü henüz kaydedilmemişse içinde implementationFactory belirtilen fabrikayı collection kullanarak belirtilen hizmet olarak Singleton değerini ekler.

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

Parametreler

service
Type

Kaydedilecek hizmetin türü.

implementationFactory
Func<IServiceProvider,Object>

Hizmeti oluşturan fabrika.

Şunlara uygulanır

TryAddSingleton(IServiceCollection, Type)

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

Hizmet servicecollection türü henüz kaydedilmemişse, belirtilen hizmet olarak Singleton öğesini öğesine ekler.

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)

Parametreler

service
Type

Kaydedilecek hizmetin türü.

Şunlara uygulanır

TryAddSingleton<TService,TImplementation>(IServiceCollection)

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

Belirtilen TService hizmet türü önceden kaydedilmemişse içinde belirtilen TImplementationcollection hizmet uygulama türü olarak Singleton öğesini ekler.

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)

Tür Parametreleri

TService

Eklenecek hizmetin türü.

TImplementation

Kullanılacak uygulamanın türü.

Parametreler

Şunlara uygulanır

TryAddSingleton<TService>(IServiceCollection)

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

Hizmet TServicecollection türü henüz kaydedilmemişse, belirtilen hizmet olarak Singleton öğesini öğesine ekler.

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)

Tür Parametreleri

TService

Eklenecek hizmetin türü.

Parametreler

Şunlara uygulanır

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

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

TService Hizmet türü henüz kaydedilmemişse içinde implementationFactory belirtilen fabrikayı services kullanarak belirtilen hizmet olarak Singleton değerini ekler.

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

Tür Parametreleri

TService

Eklenecek hizmetin türü.

Parametreler

implementationFactory
Func<IServiceProvider,TService>

Hizmeti oluşturan fabrika.

Şunlara uygulanır

TryAddSingleton<TService>(IServiceCollection, TService)

Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs
Kaynak:
ServiceCollectionDescriptorExtensions.cs

Hizmet TServiceSingleton türü henüz kaydedilmemişse içinde belirtilen instancecollection örneğiyle belirtilen hizmeti olarak ekler.

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)

Tür Parametreleri

TService

Eklenecek hizmetin türü.

Parametreler

instance
TService

Eklenecek hizmetin örneği.

Şunlara uygulanır