KeyedServiceExtensions.AddSingletonNamedService Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
AddSingletonNamedService<TService,TInstance>(IServiceCollection, String) |
Регистрация одноэлементной службы |
AddSingletonNamedService<TService>(IServiceCollection, String, Func<IServiceProvider,String,TService>) |
Регистрация одноэлементной службы |
AddSingletonNamedService<TService>(IServiceCollection, String, Type) |
AddSingletonNamedService<TService,TInstance>(IServiceCollection, String)
- Исходный код:
- KeyedService.cs
Регистрация одноэлементной службы
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingletonNamedService<TService,TInstance> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, string name) where TService : class where TInstance : class, TService;
static member AddSingletonNamedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingletonNamedService(Of TService As Class, TInstance As Class) (collection As IServiceCollection, name As String) As IServiceCollection
Параметры типа
- TService
- TInstance
Параметры
- collection
- IServiceCollection
- name
- String
Возвращаемое значение
Применяется к
AddSingletonNamedService<TService>(IServiceCollection, String, Func<IServiceProvider,String,TService>)
- Исходный код:
- KeyedService.cs
Регистрация одноэлементной службы
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingletonNamedService<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, string name, Func<IServiceProvider,string,TService> factory) where TService : class;
static member AddSingletonNamedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Func<IServiceProvider, string, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingletonNamedService(Of TService As Class) (collection As IServiceCollection, name As String, factory As Func(Of IServiceProvider, String, TService)) As IServiceCollection
Параметры типа
- TService
Параметры
- collection
- IServiceCollection
- name
- String
- factory
- Func<IServiceProvider,String,TService>
Возвращаемое значение
Применяется к
AddSingletonNamedService<TService>(IServiceCollection, String, Type)
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddSingletonNamedService<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection collection, string name, Type implementationType) where TService : class;
static member AddSingletonNamedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Type -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddSingletonNamedService(Of TService As Class) (collection As IServiceCollection, name As String, implementationType As Type) As IServiceCollection
Параметры типа
- TService
Параметры
- collection
- IServiceCollection
- name
- String
- implementationType
- Type