Container.AddService Method

Definition

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new service to the container.

Overloads

AddService<T,V>(String, ActivationContext<V>)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new service to the container.

AddService<T,V>(String, V)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new service to the container by instantiating the type T. The default lifetime will be singleton.

AddService<T,V>(String, ActivationContext<V>)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new service to the container.

public:
generic <typename T, typename V>
 where T : class where V : T virtual void AddService(System::String ^ name, Microsoft::EnterpriseManagement::ActivationContext<V> ^ context);
public void AddService<T,V> (string name, Microsoft.EnterpriseManagement.ActivationContext<V> context) where T : class where V : T;
abstract member AddService : string * Microsoft.EnterpriseManagement.ActivationContext<#'T> -> unit (requires 'T : null)
override this.AddService : string * Microsoft.EnterpriseManagement.ActivationContext<#'T> -> unit (requires 'T : null)
Public Sub AddService(Of T As Class, V As Class) (name As String, context As ActivationContext(Of V))

Type Parameters

T

The type of the service to instantiate.

V

The type of object to create.

Parameters

name
String

The name that the service will be stored as.

context
ActivationContext<V>

The context activator of the service.

Implements

Exceptions

The context parameter is a null reference (Nothing in Visual Basic) or empty.

Applies to

AddService<T,V>(String, V)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds a new service to the container by instantiating the type T. The default lifetime will be singleton.

public:
generic <typename T, typename V>
 where T : class where V : T virtual void AddService(System::String ^ name, V instance);
public void AddService<T,V> (string name, V instance) where T : class where V : T;
abstract member AddService : string * 'V -> unit (requires 'T : null)
override this.AddService : string * 'V -> unit (requires 'T : null)
Public Sub AddService(Of T As Class, V As Class) (name As String, instance As V)

Type Parameters

T

The type of the service to instantiate.

V

The type of object to create.

Parameters

name
String

The name that the service will be stored as.

instance
V

The instance to store.

Implements

Exceptions

The context parameter is a null reference (Nothing in Visual Basic) or empty.

Applies to