| ServiceContainerRegister Method (Type, String, FuncServiceContainer, Object, CreationPolicy) |
Registers a services using a custom factory method and a certain creation policy.
Namespace: DigitalRune.ServiceLocationAssembly: DigitalRune.ServiceLocation (in DigitalRune.ServiceLocation.dll) Version: 1.3.0.0 (1.3.0.13596)
Syntax public void Register(
Type serviceType,
string key,
Func<ServiceContainer, Object> createInstance,
CreationPolicy creationPolicy
)
Public Sub Register (
serviceType As Type,
key As String,
createInstance As Func(Of ServiceContainer, Object),
creationPolicy As CreationPolicy
)
public:
void Register(
Type^ serviceType,
String^ key,
Func<ServiceContainer^, Object^>^ createInstance,
CreationPolicy creationPolicy
)
member Register :
serviceType : Type *
key : string *
createInstance : Func<ServiceContainer, Object> *
creationPolicy : CreationPolicy -> unit
Parameters
- serviceType
- Type: SystemType
The type of the service. - key
- Type: SystemString
The name under which the object should be registered. Can be or
empty.
- createInstance
- Type: SystemFuncServiceContainer, Object
The factory method responsible for serving the requests from the container.
- creationPolicy
- Type: DigitalRune.ServiceLocationCreationPolicy
The creation policy that specifies when and how a service will be instantiated.
Exceptions Remarks
The service instance will be automatically disposed when the container is disposed
(disposal policy Automatic).
If a service with the same type and name is already registered, the existing entry will
be replaced.
See Also