Class HttpContextExtensions
Inheritance
HttpContextExtensions
Assembly: FastEndpoints.dll
Syntax
public static class HttpContextExtensions
Methods
MarkResponseStart(HttpContext)
Declaration
public static void MarkResponseStart(this HttpContext ctx)
Parameters
ProcessorState<TState>(HttpContext)
retrieve the common processor state for the current http context.
Declaration
public static TState ProcessorState<TState>(this HttpContext ctx) where TState : class, new()
Parameters
Returns
Type Parameters
Name |
Description |
TState |
the type of the processor state
|
Exceptions
Type |
Condition |
InvalidOperationException |
thrown if the requested type of the processor state does not match with what's already stored in the
context
|
Resolve(HttpContext, Type)
resolve an instance for the given type from the dependency injection container. will throw if unresolvable.
Declaration
public static object Resolve(this HttpContext _, Type typeOfService)
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
Type |
typeOfService |
the type of the service to resolve
|
Returns
Exceptions
Resolve<TService>(HttpContext)
resolve an instance for the given type from the dependency injection container. will throw if unresolvable.
Declaration
public static TService Resolve<TService>(this HttpContext _) where TService : class
Parameters
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
the type of the service to resolve
|
Exceptions
ResponseStarted(HttpContext)
check if the current response has already started or not.
Declaration
public static bool ResponseStarted(this HttpContext ctx)
Parameters
Returns
TryResolve(HttpContext, 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 HttpContext _, Type typeOfService)
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
Type |
typeOfService |
the type of the service to resolve
|
Returns
TryResolve<TService>(HttpContext)
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 HttpContext _) where TService : class
Parameters
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
the type of the service to resolve
|