Search Results for

    Show / Hide Table of Contents

    Class EndpointDefinition

    represents the configuration settings of an endpoint

    Inheritance
    System.Object
    EndpointDefinition
    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 sealed class EndpointDefinition

    Properties

    AllowAnyClaim

    represents the configuration settings of an endpoint

    Declaration
    public bool AllowAnyClaim { get; }
    Property Value
    Type Description
    System.Boolean

    AllowAnyPermission

    represents the configuration settings of an endpoint

    Declaration
    public bool AllowAnyPermission { get; }
    Property Value
    Type Description
    System.Boolean

    AllowedClaimTypes

    represents the configuration settings of an endpoint

    Declaration
    public List<string> AllowedClaimTypes { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    AllowedPermissions

    represents the configuration settings of an endpoint

    Declaration
    public List<string> AllowedPermissions { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    AllowedRoles

    represents the configuration settings of an endpoint

    Declaration
    public List<string> AllowedRoles { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    AnonymousVerbs

    represents the configuration settings of an endpoint

    Declaration
    public string[] AnonymousVerbs { get; }
    Property Value
    Type Description
    System.String[]

    AuthSchemeNames

    represents the configuration settings of an endpoint

    Declaration
    public List<string> AuthSchemeNames { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    DoNotCatchExceptions

    represents the configuration settings of an endpoint

    Declaration
    public bool DoNotCatchExceptions { get; }
    Property Value
    Type Description
    System.Boolean

    DontAutoTagEndpoints

    represents the configuration settings of an endpoint

    Declaration
    public bool DontAutoTagEndpoints { get; }
    Property Value
    Type Description
    System.Boolean

    DontBindFormData

    represents the configuration settings of an endpoint

    Declaration
    public bool DontBindFormData { get; }
    Property Value
    Type Description
    System.Boolean

    EndpointSummary

    represents the configuration settings of an endpoint

    Declaration
    public EndpointSummary EndpointSummary { get; }
    Property Value
    Type Description
    EndpointSummary

    EndpointTags

    represents the configuration settings of an endpoint

    Declaration
    public List<string> EndpointTags { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    EndpointType

    represents the configuration settings of an endpoint

    Declaration
    public Type EndpointType { get; }
    Property Value
    Type Description
    System.Type

    FormDataAllowed

    represents the configuration settings of an endpoint

    Declaration
    public bool FormDataAllowed { get; }
    Property Value
    Type Description
    System.Boolean

    MapperType

    represents the configuration settings of an endpoint

    Declaration
    public Type MapperType { get; }
    Property Value
    Type Description
    System.Type

    OverriddenRoutePrefix

    represents the configuration settings of an endpoint

    Declaration
    public string OverriddenRoutePrefix { get; }
    Property Value
    Type Description
    System.String

    PolicyBuilder

    represents the configuration settings of an endpoint

    Declaration
    public Action<AuthorizationPolicyBuilder> PolicyBuilder { get; }
    Property Value
    Type Description
    System.Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder>

    PreBuiltUserPolicies

    represents the configuration settings of an endpoint

    Declaration
    public List<string> PreBuiltUserPolicies { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    ReqDtoType

    represents the configuration settings of an endpoint

    Declaration
    public Type ReqDtoType { get; }
    Property Value
    Type Description
    System.Type

    Routes

    represents the configuration settings of an endpoint

    Declaration
    public string[] Routes { get; }
    Property Value
    Type Description
    System.String[]

    SecurityPolicyName

    represents the configuration settings of an endpoint

    Declaration
    public string SecurityPolicyName { get; }
    Property Value
    Type Description
    System.String

    ThrowIfValidationFails

    represents the configuration settings of an endpoint

    Declaration
    public bool ThrowIfValidationFails { get; }
    Property Value
    Type Description
    System.Boolean

    ValidatorType

    represents the configuration settings of an endpoint

    Declaration
    public Type ValidatorType { get; }
    Property Value
    Type Description
    System.Type

    Verbs

    represents the configuration settings of an endpoint

    Declaration
    public string[] Verbs { get; }
    Property Value
    Type Description
    System.String[]

    Version

    represents the configuration settings of an endpoint

    Declaration
    public EpVersion Version { get; }
    Property Value
    Type Description
    EpVersion

    Methods

    AllowAnonymous(Http[])

    allow unauthenticated requests to this endpoint. optionally specify a set of verbs to allow unauthenticated access with. i.e. if the endpoint is listening to POST, PUT & PATCH and you specify AllowAnonymous(Http.POST), then only PUT & PATCH will require authentication.

    Declaration
    public void AllowAnonymous(params Http[] verbs)
    Parameters
    Type Name Description
    Http[] verbs

    AllowAnonymous(String[])

    allow unauthenticated requests to this endpoint for a specified set of http verbs.

    Declaration
    public void AllowAnonymous(string[] verbs)
    Parameters
    Type Name Description
    System.String[] verbs

    AllowFileUploads(Boolean)

    enable file uploads with multipart/form-data content type

    Declaration
    public void AllowFileUploads(bool dontAutoBindFormData = false)
    Parameters
    Type Name Description
    System.Boolean dontAutoBindFormData

    set 'true' to disable auto binding of form data which enables uploading and reading of large files without buffering to memory/disk. you can access the multipart sections for reading via the FormFileSectionsAsync() method.

    AllowFormData()

    enable multipart/form-data submissions

    Declaration
    public void AllowFormData()

    AuthSchemes(String[])

    specify which authentication schemes to use for authenticating requests to this endpoint

    HINT: these auth schemes will be applied in addition to endpoint level auth schemes if there's any

    Declaration
    public void AuthSchemes(params string[] authSchemeNames)
    Parameters
    Type Name Description
    System.String[] authSchemeNames

    the authentication scheme names

    Claims(String[])

    allows access if the claims principal has ANY of the given claim types

    HINT: these claims will be applied in addition to endpoint level claims if there's any

    Declaration
    public void Claims(params string[] claimTypes)
    Parameters
    Type Name Description
    System.String[] claimTypes

    the claim types

    ClaimsAll(String[])

    allows access if the claims principal has ALL of the given claim types

    HINT: these claims will be applied in addition to endpoint level claims if there's any

    Declaration
    public void ClaimsAll(params string[] claimTypes)
    Parameters
    Type Name Description
    System.String[] claimTypes

    the claim types

    Description(Action<RouteHandlerBuilder>, Boolean)

    describe openapi metadata for this endpoint. optionaly specify whether or not you want to clear the default Accepts/Produces metadata.

    EXAMPLE: b => b.Accepts<Request>("text/plain")

    Declaration
    public void Description(Action<RouteHandlerBuilder> builder, bool clearDefaults = false)
    Parameters
    Type Name Description
    System.Action<Microsoft.AspNetCore.Builder.RouteHandlerBuilder> builder

    the route handler builder for this endpoint

    System.Boolean clearDefaults

    set to true if the defaults should be cleared

    DontAutoTag()

    if swagger auto tagging based on path segment is enabled, calling this method will prevent a tag from being added to this endpoint.

    Declaration
    public void DontAutoTag()

    DontCatchExceptions()

    use this only if you have your own exception catching middleware. if this method is called in config, an automatic error response will not be sent to the client by the library. all exceptions will be thrown and it would be your exeception catching middleware to handle them.

    Declaration
    public void DontCatchExceptions()

    DontThrowIfValidationFails()

    disable auto validation failure responses (400 bad request with error details) for this endpoint.

    HINT: this only applies to request dto validation.

    Declaration
    public void DontThrowIfValidationFails()

    EndpointVersion(Int32, Nullable<Int32>)

    specify the version of the endpoint if versioning is enabled

    Declaration
    public void EndpointVersion(int version, int? deprecateAt = null)
    Parameters
    Type Name Description
    System.Int32 version

    the version of this endpoint

    System.Nullable<System.Int32> deprecateAt

    the version group number starting at which this endpoint should not be included in swagger document

    Options(Action<RouteHandlerBuilder>)

    set endpoint configurations options using an endpoint builder action ///

    Declaration
    public void Options(Action<RouteHandlerBuilder> builder)
    Parameters
    Type Name Description
    System.Action<Microsoft.AspNetCore.Builder.RouteHandlerBuilder> builder

    the builder for this endpoint

    Permissions(String[])

    allows access if the claims principal has ANY of the given permissions

    HINT: these permissions will be applied in addition to endpoint level permissions if there's any

    Declaration
    public void Permissions(params string[] permissions)
    Parameters
    Type Name Description
    System.String[] permissions

    the permissions

    PermissionsAll(String[])

    allows access if the claims principal has ALL of the given permissions

    HINT: these permissions will be applied in addition to endpoint level permissions if there's any

    Declaration
    public void PermissionsAll(params string[] permissions)
    Parameters
    Type Name Description
    System.String[] permissions

    the permissions

    Policies(String[])

    specify one or more authorization policy names you have added to the middleware pipeline during app startup/ service configuration that should be applied to this endpoint.

    HINT: these policies will be applied in addition to endpoint level policies if there's any

    Declaration
    public void Policies(params string[] policyNames)
    Parameters
    Type Name Description
    System.String[] policyNames

    one or more policy names (must have been added to the pipeline on startup)

    Policy(Action<AuthorizationPolicyBuilder>)

    specify an action for building an authorization requirement which should be added to all endpoints globally.

    HINT: these global level requirements will be combined with the requirements specified at the endpoint level if there's any.

    Declaration
    public void Policy(Action<AuthorizationPolicyBuilder> policy)
    Parameters
    Type Name Description
    System.Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> policy

    th policy builder action

    PostProcessors(Order, IGlobalPostProcessor[])

    adds global post-processors to an endpoint definition which are to be executed in addition to the ones configured at the endpoint level.

    Declaration
    public void PostProcessors(Order order, params IGlobalPostProcessor[] postProcessors)
    Parameters
    Type Name Description
    Order order

    set to Before if the global post-processors should be executed before endpoint post-processors. After will execute global processors after endpoint level processors

    IGlobalPostProcessor[] postProcessors

    the post-processors to add

    PreProcessors(Order, IGlobalPreProcessor[])

    adds global pre-processors to an endpoint definition which are to be executed in addition to the ones configured at the endpoint level.

    Declaration
    public void PreProcessors(Order order, params IGlobalPreProcessor[] preProcessors)
    Parameters
    Type Name Description
    Order order

    set to Before if the global pre-processors should be executed before endpoint pre-processors. After will execute global processors after endpoint level processors

    IGlobalPreProcessor[] preProcessors

    the pre-processors to add

    ResponseCache(Int32, ResponseCacheLocation, Boolean, String, String[])

    specify response caching settings for this endpoint

    Declaration
    public void ResponseCache(int durationSeconds, ResponseCacheLocation location = ResponseCacheLocation.Any, bool noStore = false, string varyByHeader = null, string[] varyByQueryKeys = null)
    Parameters
    Type Name Description
    System.Int32 durationSeconds

    the duration in seconds for which the response is cached

    Microsoft.AspNetCore.Mvc.ResponseCacheLocation location

    the location where the data from a particular URL must be cached

    System.Boolean noStore

    specify whether the data should be stored or not

    System.String varyByHeader

    the value for the Vary response header

    System.String[] varyByQueryKeys

    the query keys to vary by

    ResponseInterceptor(IResponseInterceptor)

    configure a response interceptor to be called before any SendAsync() methods are called. if the interceptor sends a response to the client, the SendAsync() will be ignored.

    Declaration
    public void ResponseInterceptor(IResponseInterceptor responseInterceptor)
    Parameters
    Type Name Description
    IResponseInterceptor responseInterceptor

    the response interceptor to be configured for the endpoint

    Roles(String[])

    allows access if the claims principal has ANY of the given roles

    HINT: these roles will be applied in addition to endpoint level roles if there's any

    Declaration
    public void Roles(params string[] rolesNames)
    Parameters
    Type Name Description
    System.String[] rolesNames

    one or more roles that has access

    RoutePrefixOverride(String)

    specify an override route prefix for this endpoint if a global route prefix is enabled. this is ignored if a global route prefix is not configured. global prefix can be ignored by setting string.Empty

    WARNING: setting a route prefix override globally makes the endpoint level override ineffective. i.e. RoutePrefixOverride() method call on endpoint level will be ignored.

    Declaration
    public void RoutePrefixOverride(string routePrefix)
    Parameters
    Type Name Description
    System.String routePrefix

    route prefix value

    Summary(EndpointSummary)

    provide a summary/description for this endpoint to be used in swagger/ openapi

    Declaration
    public void Summary(EndpointSummary endpointSummary)
    Parameters
    Type Name Description
    EndpointSummary endpointSummary

    an endpoint summary instance

    Summary(Action<EndpointSummary>)

    provide a summary/description for this endpoint to be used in swagger/ openapi

    Declaration
    public void Summary(Action<EndpointSummary> endpointSummary)
    Parameters
    Type Name Description
    System.Action<EndpointSummary> endpointSummary

    an action that sets values of an endpoint summary object

    Summary<TRequest>(Action<EndpointSummary<TRequest>>)

    provide a summary/description for this endpoint to be used in swagger/ openapi

    Declaration
    public void Summary<TRequest>(Action<EndpointSummary<TRequest>> endpointSummary)
    Parameters
    Type Name Description
    System.Action<EndpointSummary<TRequest>> endpointSummary

    an action that sets values of an endpoint summary object

    Type Parameters
    Name Description
    TRequest

    Tags(String[])

    specify one or more string tags for this endpoint so they can be used in the exclusion filter during registration.

    HINT: these tags will be applied in addition to endpoint level tags if there's any

    TIP: these tags have nothing to do with swagger tags!

    Declaration
    public void Tags(params string[] endpointTags)
    Parameters
    Type Name Description
    System.String[] endpointTags

    the tag values to associate with this endpoint

    Throttle(Int32, Double, String)

    rate limit requests to this endpoint based on a request http header sent by the client.

    Declaration
    public void Throttle(int hitLimit, double durationSeconds, string headerName = null)
    Parameters
    Type Name Description
    System.Int32 hitLimit

    how many requests are allowed within the given duration

    System.Double durationSeconds

    the frequency in seconds where the accrued hit count should be reset

    System.String headerName

    the name of the request header used to uniquely identify clients. header name can also be configured globally using app.UseFastEndpoints(c=> c.Throttle...) not specifying a header name will first look for 'X-Forwarded-For' header and if not present, will use HttpContext.Connection.RemoteIpAddress.

    Validator<TValidator>()

    validator that should be used for this endpoint

    Declaration
    public void Validator<TValidator>()
        where TValidator : IValidator
    Type Parameters
    Name Description
    TValidator

    the type of the validator

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