ServiceUse Method (Type, Object, String) |
Sets instance to be used as implementation of service.
Namespace: CMS.CoreAssembly: CMS.Core (in CMS.Core.dll) Version: 13.0.131
Syntax public static void Use(
Type service,
Object instance,
string name = null
)
Parameters
- service
- Type: SystemType
Type of service being implemented. - instance
- Type: SystemObject
Instance of service implementation to be used. - 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.
Exceptions Exception | Condition |
---|
ArgumentNullException | Thrown when service or instance is null. |
ServiceRegistrationException | Thrown 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