Class AspNetCoreEndpointMapper

Namespace
Microsoft.AspNetCore.Builder
Assembly
Cratis.Arc.dll

ASP.NET Core implementation of IEndpointMapper.

public class AspNetCoreEndpointMapper : IEndpointMapper
Inheritance
AspNetCoreEndpointMapper
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the AspNetCoreEndpointMapper class.

Constructors

AspNetCoreEndpointMapper(IEndpointRouteBuilder, string?)

ASP.NET Core implementation of IEndpointMapper.

public AspNetCoreEndpointMapper(IEndpointRouteBuilder endpoints, string? groupPrefix = null)

Parameters

endpoints IEndpointRouteBuilder

The IEndpointRouteBuilder.

groupPrefix string

Optional group prefix for all routes.

Remarks

Initializes a new instance of the AspNetCoreEndpointMapper class.

Methods

EndpointExists(string)

Checks if an endpoint with the given name already exists.

public bool EndpointExists(string name)

Parameters

name string

The endpoint name.

Returns

bool

True if the endpoint exists.

MapGet(string, Func<IHttpRequestContext, Task>, EndpointMetadata?)

Maps a GET endpoint.

public void MapGet(string pattern, Func<IHttpRequestContext, Task> handler, EndpointMetadata? metadata = null)

Parameters

pattern string

The route pattern.

handler Func<IHttpRequestContext, Task>

The handler for the request.

metadata EndpointMetadata

Optional metadata for the endpoint (tags, name, etc.).

MapMethod(string, string, Func<IHttpRequestContext, Task>, EndpointMetadata?)

Maps an endpoint for the given HTTP method.

public void MapMethod(string httpMethod, string pattern, Func<IHttpRequestContext, Task> handler, EndpointMetadata? metadata = null)

Parameters

httpMethod string

The HTTP method (e.g. GET, POST, QUERY) to map.

pattern string

The route pattern.

handler Func<IHttpRequestContext, Task>

The handler for the request.

metadata EndpointMetadata

Optional metadata for the endpoint (tags, name, etc.).

Remarks

This is the general extension point for mapping endpoints — new HTTP methods (such as QUERY) are supported by passing the method token, without changing the callers. The default implementation dispatches GET and POST to MapGet(string, Func<IHttpRequestContext, Task>, EndpointMetadata?) and MapPost(string, Func<IHttpRequestContext, Task>, EndpointMetadata?) and ignores any other method; implementers that support additional verbs (such as QUERY) override this.

MapPost(string, Func<IHttpRequestContext, Task>, EndpointMetadata?)

Maps a POST endpoint.

public void MapPost(string pattern, Func<IHttpRequestContext, Task> handler, EndpointMetadata? metadata = null)

Parameters

pattern string

The route pattern.

handler Func<IHttpRequestContext, Task>

The handler for the request.

metadata EndpointMetadata

Optional metadata for the endpoint (tags, name, etc.).