Click or drag to resize
ServiceUse Method (Type, Type, String, Boolean)
Sets implementation to be used as implementation of service.

Namespace: CMS.Core
Assembly: CMS.Core (in CMS.Core.dll) Version: 13.0.131
Syntax
C#
public static void Use(
	Type service,
	Type implementation,
	string name = null,
	bool transient = false
)

Parameters

service
Type: SystemType
Type of service being implemented.
implementation
Type: SystemType
Implementing type for service.
name (Optional)
Type: SystemString
Sets an explicit name of the registration. If not set, the name is automatically inferred from the implementation being registered. Name must be unique.
transient (Optional)
Type: SystemBoolean
Indicates whether service implementation lifestyle should be transient, or default to singleton.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when service or implementation is null.
ServiceRegistrationExceptionThrown when registration fails (e.g. name is not unique).
Remarks
The name does not need to be explicitly set unless registering one implementation multiple times (for various interfaces).
See Also