Share via


ContainerBuilderExtensions.AddService Method

Definition

Overloads

AddService(IContainerBuilder, ServiceLifetime, Type)

Adds a service of serviceType.

AddService<TService,TImplementation>(IContainerBuilder, ServiceLifetime)

Adds a service of TService with an TImplementation.

AddService<TService>(IContainerBuilder, ServiceLifetime)

Adds a service of TService.

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

Adds a service of TService with an implementationFactory.

AddService(IContainerBuilder, ServiceLifetime, Type)

Adds a service of 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

Parameters

builder
IContainerBuilder

The IContainerBuilder to add the service to.

lifetime
ServiceLifetime

The lifetime of the service to register.

serviceType
Type

The type of the service to register and the implementation to use.

Returns

The IContainerBuilder instance itself.

Applies to

AddService<TService,TImplementation>(IContainerBuilder, ServiceLifetime)

Adds a service of TService with an 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

Type Parameters

TService

The type of the service to add.

TImplementation

The type of the implementation to use.

Parameters

builder
IContainerBuilder

The IContainerBuilder to add the service to.

lifetime
ServiceLifetime

The lifetime of the service to register.

Returns

The IContainerBuilder instance itself.

Applies to

AddService<TService>(IContainerBuilder, ServiceLifetime)

Adds a service of 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

Type Parameters

TService

The type of the service to add.

Parameters

builder
IContainerBuilder

The IContainerBuilder to add the service to.

lifetime
ServiceLifetime

The lifetime of the service to register.

Returns

The IContainerBuilder instance itself.

Applies to

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

Adds a service of TService with an 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

Type Parameters

TService

The type of the service to add.

Parameters

builder
IContainerBuilder

The IContainerBuilder to add the service to.

lifetime
ServiceLifetime

The lifetime of the service to register.

implementationFactory
Func<IServiceProvider,TService>

The factory that creates the service.

Returns

The IContainerBuilder instance itself.

Applies to