ServiceCollectionDescriptorExtensions.TryAddSingleton Metod

Definition

Överlagringar

Name Description
TryAddSingleton(IServiceCollection, Type, Type)

Lägger till den angivna service som en Singleton tjänst med implementeringen implementationType till collection om tjänsttypen inte redan har registrerats.

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

Lägger till den angivna service som en Singleton tjänst med den fabrik som anges i implementationFactorycollection i om tjänsttypen inte redan har registrerats.

TryAddSingleton(IServiceCollection, Type)

Lägger till den angivna service som en Singleton tjänst i collection om tjänsttypen inte redan har registrerats.

TryAddSingleton<TService,TImplementation>(IServiceCollection)

Lägger till den angivna TService som en Singleton tjänstimplementeringstyp som anges i TImplementationcollection om tjänsttypen inte redan har registrerats.

TryAddSingleton<TService>(IServiceCollection)

Lägger till den angivna TService som en Singleton tjänst i collection om tjänsttypen inte redan har registrerats.

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

Lägger till den angivna TService som en Singleton tjänst med den fabrik som anges i implementationFactoryservices i om tjänsttypen inte redan har registrerats.

TryAddSingleton<TService>(IServiceCollection, TService)

Lägger till den angivna TService som en Singleton tjänst med en instans som anges i instancecollection om tjänsttypen inte redan har registrerats.

TryAddSingleton(IServiceCollection, Type, Type)

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna service som en Singleton tjänst med implementeringen implementationType till collection om tjänsttypen inte redan har registrerats.

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)

Parametrar

service
Type

Vilken typ av tjänst som ska registreras.

implementationType
Type

Implementeringstypen för tjänsten.

Se även

Gäller för

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

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna service som en Singleton tjänst med den fabrik som anges i implementationFactorycollection i om tjänsttypen inte redan har registrerats.

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

Parametrar

service
Type

Vilken typ av tjänst som ska registreras.

implementationFactory
Func<IServiceProvider,Object>

Fabriken som skapar tjänsten.

Se även

Gäller för

TryAddSingleton(IServiceCollection, Type)

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna service som en Singleton tjänst i collection om tjänsttypen inte redan har registrerats.

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)

Parametrar

service
Type

Vilken typ av tjänst som ska registreras.

Se även

Gäller för

TryAddSingleton<TService,TImplementation>(IServiceCollection)

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna TService som en Singleton tjänstimplementeringstyp som anges i TImplementationcollection om tjänsttypen inte redan har registrerats.

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)

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

TImplementation

Vilken typ av implementering som ska användas.

Parametrar

Se även

Gäller för

TryAddSingleton<TService>(IServiceCollection)

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna TService som en Singleton tjänst i collection om tjänsttypen inte redan har registrerats.

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)

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

Parametrar

Se även

Gäller för

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

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna TService som en Singleton tjänst med den fabrik som anges i implementationFactoryservices i om tjänsttypen inte redan har registrerats.

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

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

Parametrar

implementationFactory
Func<IServiceProvider,TService>

Fabriken som skapar tjänsten.

Se även

Gäller för

TryAddSingleton<TService>(IServiceCollection, TService)

Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs
Källa:
ServiceCollectionDescriptorExtensions.cs

Lägger till den angivna TService som en Singleton tjänst med en instans som anges i instancecollection om tjänsttypen inte redan har registrerats.

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)

Typparametrar

TService

Vilken typ av tjänst som ska läggas till.

Parametrar

instance
TService

Den instans av tjänsten som ska läggas till.

Se även

Gäller för