Search Results for

    Show / Hide Table of Contents

    Class HttpContextExtensions

    Inheritance
    System.Object
    HttpContextExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.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
    Microsoft.AspNetCore.Http.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
    Microsoft.AspNetCore.Http.HttpContext ctx
    Returns
    Type Description
    TState
    Type Parameters
    Name Description
    TState

    the type of the processor state

    Exceptions
    Type Condition
    System.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
    Microsoft.AspNetCore.Http.HttpContext _
    System.Type typeOfService

    the type of the service to resolve

    Returns
    Type Description
    System.Object
    Exceptions
    Type Condition
    System.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
    Microsoft.AspNetCore.Http.HttpContext _
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    Exceptions
    Type Condition
    System.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
    Microsoft.AspNetCore.Http.HttpContext ctx
    Returns
    Type Description
    System.Boolean

    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
    Microsoft.AspNetCore.Http.HttpContext _
    System.Type typeOfService

    the type of the service to resolve

    Returns
    Type Description
    System.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
    Microsoft.AspNetCore.Http.HttpContext _
    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