Method UseService
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
UseService<T>()
Resolves a service from the IHookServiceResolver provided through Ref. A service-locator hook that reads the host resolver from context, keeping the lookup DI-framework-neutral.
public static T UseService<T>() where T : class
Returns
- T
The instance returned by the host resolver.
Type Parameters
TService contract type to resolve.
Exceptions
- InvalidOperationException
Thrown when no HookServiceContext Provider is mounted above the caller, or when the host IHookServiceResolver returns null in violation of its contract.