IContainer.AddService Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
[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 |
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 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)
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.
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 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)
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.