Delegate TypedRequestEndpointHandlerDelegate<TRequestContext>

Represents a typed endpoint handler in the router pipeline.

Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public delegate Task<HttpResponseMessage> TypedRequestEndpointHandlerDelegate<TRequestContext>(TRequestContext requestContext) where TRequestContext : new()
Parameters
Type Name Description
TRequestContext requestContext

The typed request object built from the current RequestContext.

Returns
Type Description
Task<HttpResponseMessage>

The response produced by the current handler.

Type Parameters
Name Description
TRequestContext

The request-object type populated from the current route parameters, query bindings, services, and special framework values.

Remarks

This delegate is used by NanoRouteHandlerExtensions overloads that do not expose CallNextHandlerDelegate. The pipeline stops when the handler returns. Exceptions thrown by the handler propagate through the routing pipeline unless middleware handles them.

Examples
builder.AddHandler<UserRequest>("GET", "/users/{id:int}/", request =>
    Results.Ok(request.Id));
In this article
Back to top Generated by DocFX