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
endpointsIEndpointRouteBuildergroupPrefixstringOptional 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
namestringThe 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
patternstringThe route pattern.
handlerFunc<IHttpRequestContext, Task>The handler for the request.
metadataEndpointMetadataOptional 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
httpMethodstringThe HTTP method (e.g. GET, POST, QUERY) to map.
patternstringThe route pattern.
handlerFunc<IHttpRequestContext, Task>The handler for the request.
metadataEndpointMetadataOptional 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
patternstringThe route pattern.
handlerFunc<IHttpRequestContext, Task>The handler for the request.
metadataEndpointMetadataOptional metadata for the endpoint (tags, name, etc.).