ServiceUseTService Method (Object, String, Boolean) |
Sets instance to be used as implementation of TService.
Namespace: CMS.CoreAssembly: CMS.Core (in CMS.Core.dll) Version: 11.0.0
Syntaxpublic static void Use<TService>(
Object instance,
string name = null,
bool transient = false
)
Parameters
- instance
- Type: SystemObject
Instance of TService 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. - transient (Optional)
- Type: SystemBoolean
Indicates whether service implementation lifestyle should be transient, or default to singleton.
Type Parameters
- TService
- Service being implemented.
Exceptions
Remarks
The name does not need to be explicitly set unless registering one implementation multiple times (for various interfaces).
See Also