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(HttpContext, Type, string)
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, string keyName)
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
Type |
typeOfService |
the type of the service to resolve
|
string |
keyName |
the key name to resolve a keyed service
|
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
Resolve<TService>(HttpContext, string)
resolve an instance for the given type from the dependency injection container. will throw if unresolvable.
Declaration
public static TService Resolve<TService>(this HttpContext _, string keyName) where TService : class
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
string |
keyName |
the key name to resolve a keyed service
|
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(HttpContext, Type, string)
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, string keyName)
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
Type |
typeOfService |
the type of the service to resolve
|
string |
keyName |
the key name to resolve a keyed service
|
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
|
TryResolve<TService>(HttpContext, string)
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 _, string keyName) where TService : class
Parameters
Type |
Name |
Description |
HttpContext |
_ |
|
string |
keyName |
the key name to resolve a keyed service
|
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
the type of the service to resolve
|