Search Results for

    Show / Hide Table of Contents

    Class HttpContextExtensions

    Inheritance
    object
    HttpContextExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public static class HttpContextExtensions

    Methods

    MarkResponseStart(HttpContext)

    marks the current response as started so that ResponseStarted(HttpContext) can return the correct result.

    Declaration
    public static void MarkResponseStart(this HttpContext ctx)
    Parameters
    Type Name Description
    HttpContext ctx

    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
    Type Name Description
    HttpContext ctx
    Returns
    Type Description
    TState
    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
    Type Description
    object
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    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
    Type Description
    object
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    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
    Type Name Description
    HttpContext _
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    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
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    ResponseStarted(HttpContext)

    check if the current response has already started or not.

    Declaration
    public static bool ResponseStarted(this HttpContext ctx)
    Parameters
    Type Name Description
    HttpContext ctx
    Returns
    Type Description
    bool

    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
    Type Description
    object

    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
    Type Description
    object

    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
    Type Name Description
    HttpContext _
    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

    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX