GetRequiredScopedService Method
Definition
- Namespace
- Codebelt.Extensions.Xunit.Hosting
- Assemblies
- Codebelt.Extensions.Xunit.Hosting.dll
GetRequiredScopedService<T>(IServiceProvider)
Gets a required scoped service of type T from the IServiceProvider.
public static T GetRequiredScopedService<T>(this IServiceProvider provider)
Parameters
providerIServiceProviderThe IServiceProvider to retrieve the service from.
Returns
- T
The required service of type
T.
Type Parameters
TThe type of the service to retrieve.
Exceptions
- InvalidOperationException
There is no service of type
T.