Поделиться через


ContainerBuilderExtensions.AddService Метод

Определение

Перегрузки

AddService(IContainerBuilder, ServiceLifetime, Type)

Добавляет службу .serviceType

AddService<TService,TImplementation>(IContainerBuilder, ServiceLifetime)

Добавляет службу с TService .TImplementation

AddService<TService>(IContainerBuilder, ServiceLifetime)

Добавляет службу .TService

AddService<TService>(IContainerBuilder, ServiceLifetime, Func<IServiceProvider,TService>)

Добавляет службу с TService .implementationFactory

AddService(IContainerBuilder, ServiceLifetime, Type)

Добавляет службу .serviceType

public static Microsoft.OData.IContainerBuilder AddService (this Microsoft.OData.IContainerBuilder builder, Microsoft.OData.ServiceLifetime lifetime, Type serviceType);
static member AddService : Microsoft.OData.IContainerBuilder * Microsoft.OData.ServiceLifetime * Type -> Microsoft.OData.IContainerBuilder
<Extension()>
Public Function AddService (builder As IContainerBuilder, lifetime As ServiceLifetime, serviceType As Type) As IContainerBuilder

Параметры

builder
IContainerBuilder

Коллекция IContainerBuilder, в которую нужно добавить службу.

lifetime
ServiceLifetime

Время существования регистрируемой службы.

serviceType
Type

Тип регистрируемой службы и используемая реализация.

Возвращаемое значение

Сам IContainerBuilder экземпляр.

Применяется к

AddService<TService,TImplementation>(IContainerBuilder, ServiceLifetime)

Добавляет службу с TService .TImplementation

public static Microsoft.OData.IContainerBuilder AddService<TService,TImplementation> (this Microsoft.OData.IContainerBuilder builder, Microsoft.OData.ServiceLifetime lifetime) where TService : class where TImplementation : class, TService;
static member AddService : Microsoft.OData.IContainerBuilder * Microsoft.OData.ServiceLifetime -> Microsoft.OData.IContainerBuilder (requires 'Service : null)
<Extension()>
Public Function AddService(Of TService As Class, TImplementation As Class) (builder As IContainerBuilder, lifetime As ServiceLifetime) As IContainerBuilder

Параметры типа

TService

Тип добавляемой службы.

TImplementation

Тип используемой реализации.

Параметры

builder
IContainerBuilder

Коллекция IContainerBuilder, в которую нужно добавить службу.

lifetime
ServiceLifetime

Время существования регистрируемой службы.

Возвращаемое значение

Сам IContainerBuilder экземпляр.

Применяется к

AddService<TService>(IContainerBuilder, ServiceLifetime)

Добавляет службу .TService

public static Microsoft.OData.IContainerBuilder AddService<TService> (this Microsoft.OData.IContainerBuilder builder, Microsoft.OData.ServiceLifetime lifetime) where TService : class;
static member AddService : Microsoft.OData.IContainerBuilder * Microsoft.OData.ServiceLifetime -> Microsoft.OData.IContainerBuilder (requires 'Service : null)
<Extension()>
Public Function AddService(Of TService As Class) (builder As IContainerBuilder, lifetime As ServiceLifetime) As IContainerBuilder

Параметры типа

TService

Тип добавляемой службы.

Параметры

builder
IContainerBuilder

Коллекция IContainerBuilder, в которую нужно добавить службу.

lifetime
ServiceLifetime

Время существования регистрируемой службы.

Возвращаемое значение

Сам IContainerBuilder экземпляр.

Применяется к

AddService<TService>(IContainerBuilder, ServiceLifetime, Func<IServiceProvider,TService>)

Добавляет службу с TService .implementationFactory

public static Microsoft.OData.IContainerBuilder AddService<TService> (this Microsoft.OData.IContainerBuilder builder, Microsoft.OData.ServiceLifetime lifetime, Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member AddService : Microsoft.OData.IContainerBuilder * Microsoft.OData.ServiceLifetime * Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.OData.IContainerBuilder (requires 'Service : null)
<Extension()>
Public Function AddService(Of TService As Class) (builder As IContainerBuilder, lifetime As ServiceLifetime, implementationFactory As Func(Of IServiceProvider, TService)) As IContainerBuilder

Параметры типа

TService

Тип добавляемой службы.

Параметры

builder
IContainerBuilder

Коллекция IContainerBuilder, в которую нужно добавить службу.

lifetime
ServiceLifetime

Время существования регистрируемой службы.

implementationFactory
Func<IServiceProvider,TService>

Фабрика, создающая службу.

Возвращаемое значение

Сам IContainerBuilder экземпляр.

Применяется к