ServiceUseTService, TImplementation Method (String, Boolean) |
Sets TImplementation to be used as implementation of TService.
Namespace: CMS.CoreAssembly: CMS.Core (in CMS.Core.dll) Version: 13.0.131
Syntax public static void Use<TService, TImplementation>(
string name = null,
bool transient = false
)
where TService : class
where TImplementation : TService
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
- TService
- Service being implemented.
- TImplementation
- Implementing type for TService.
Exceptions Remarks
The name does not need to be explicitly set unless registering one implementation multiple times (for various interfaces).
See Also