Skip to main content

Definition

Assembly: Microsoft.Restier.Core.dll Namespace: Microsoft.Restier.Core Inheritance: System.Object

Syntax

Microsoft.Restier.Core.RestierContainerBuilder

Summary

The default Dependency Injection container builder for Restier.

Constructors

.ctor

Initializes a new instance of the RestierContainerBuilder class.

Syntax

public RestierContainerBuilder(System.Action<Microsoft.Restier.Core.RestierApiBuilder> configureApis = null)

Parameters

NameTypeDescription
configureApisSystem.Action<Microsoft.Restier.Core.RestierApiBuilder>Action to configure the ApiBase registrations that are available to the Container.

Remarks

The API registrations are re-created every time because new Containers are spun up per-route. It make make more sense to create a static instance to do this, so the Dictionary is only created once.

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

AddService

Adds a service of serviceType with an implementationType.

Syntax

public Microsoft.OData.IContainerBuilder AddService(Microsoft.OData.ServiceLifetime lifetime, System.Type serviceType, System.Type implementationType)

Parameters

NameTypeDescription
lifetimeMicrosoft.OData.ServiceLifetimeThe lifetime of the service to register.
serviceTypeSystem.TypeThe type of the service to register.
implementationTypeSystem.TypeThe implementation type of the service.

Returns

Type: Microsoft.OData.IContainerBuilder The IContainerBuilder instance itself.

AddService

Adds a service of serviceType with an implementationFactory.

Syntax

public Microsoft.OData.IContainerBuilder AddService(Microsoft.OData.ServiceLifetime lifetime, System.Type serviceType, System.Func<System.IServiceProvider, object> implementationFactory)

Parameters

NameTypeDescription
lifetimeMicrosoft.OData.ServiceLifetimeThe lifetime of the service to register.
serviceTypeSystem.TypeThe type of the service to register.
implementationFactorySystem.Func<System.IServiceProvider, object>The factory that creates the service.

Returns

Type: Microsoft.OData.IContainerBuilder The IContainerBuilder instance itself.

BuildContainer Virtual

Builds a container which implements IServiceProvider and contains all the services registered for a specific route.

Syntax

public virtual System.IServiceProvider BuildContainer()

Returns

Type: System.IServiceProvider The IServiceProviderdependency injection container</see> for the registered services.

Remarks

RWM: For unit test scenarios, this container may be built without any APIs opr Routes. If you are experiencing unexpected behavior, turn on Tracing so you can see the warning messages Restier might be generating.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?
  • Microsoft.OData.IContainerBuilder