Click or drag to resize
DigitalRuneServiceContainerRegister Method (Type, String, FuncServiceContainer, Object, CreationPolicy, DisposalPolicy)
Registers a service using a custom factory method and certain creation and disposal policies.

Namespace: DigitalRune.ServiceLocation
Assembly: 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,
	DisposalPolicy disposalPolicy
)

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.
disposalPolicy
Type: DigitalRune.ServiceLocationDisposalPolicy
The disposal policy that specifies when a service instance will be disposed. (Only relevant if the service instance implements IDisposable.)
Exceptions
ExceptionCondition
ArgumentNullExceptionserviceType or createInstance is .
Remarks
If a service with the same type and name is already registered, the existing entry will be replaced.
See Also