Click or drag to resize
ServiceServiceInterfaceUseServiceType Method

Note: This API is now obsolete.

Sets ServiceType to be used as implementation of ServiceInterface.

Namespace: CMS.Core
Assembly: CMS.Core (in CMS.Core.dll) Version: 11.0.0
Syntax
C#
[ObsoleteAttribute("Use CMS.Core.Service.Use<TService, TImplementation>(string, bool) instead.")]
public static void Use<ServiceType>(
	string name = null,
	bool transient = false
)
where ServiceType : class, new(), ServiceInterface

Parameters

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.

Type Parameters

ServiceType
Exceptions
ExceptionCondition
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