Class ServiceScopeExtensions
Inheritance
ServiceScopeExtensions
Assembly: FastEndpoints.dll
Syntax
public static class ServiceScopeExtensions
Methods
Resolve(IServiceScope, Type)
resolve an instance for the given type from the dependency injection container. will throw if unresolvable.
Declaration
public static object Resolve(this IServiceScope scope, Type typeOfService)
Parameters
Type |
Name |
Description |
IServiceScope |
scope |
|
Type |
typeOfService |
the type of the service to resolve
|
Returns
Exceptions
Resolve<TService>(IServiceScope)
resolve an instance for the given type from the dependency injection container. will throw if unresolvable.
Declaration
public static TService Resolve<TService>(this IServiceScope scope) where TService : class
Parameters
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
the type of the service to resolve
|
Exceptions
TryResolve(IServiceScope, Type)
try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.
Declaration
public static object? TryResolve(this IServiceScope scope, Type typeOfService)
Parameters
Type |
Name |
Description |
IServiceScope |
scope |
|
Type |
typeOfService |
the type of the service to resolve
|
Returns
TryResolve<TService>(IServiceScope)
try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.
Declaration
public static TService? TryResolve<TService>(this IServiceScope scope) where TService : class
Parameters
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
the type of the service to resolve
|