EndpointRouteBuilderExtensions.MapMethods Method

Definition

Overloads

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, RequestDelegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, Delegate)

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, RequestDelegate)

Source:
EndpointRouteBuilderExtensions.cs

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

C#
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapMethods (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Collections.Generic.IEnumerable<string> httpMethods, Microsoft.AspNetCore.Http.RequestDelegate requestDelegate);

Parameters

endpoints
IEndpointRouteBuilder

The IEndpointRouteBuilder to add the route to.

pattern
String

The route pattern.

httpMethods
IEnumerable<String>

HTTP methods that the endpoint will match.

requestDelegate
RequestDelegate

The delegate executed when the endpoint is matched.

Returns

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Applies to

ASP.NET Core 9.0 dan versi lain
Produk Versi
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

MapMethods(IEndpointRouteBuilder, String, IEnumerable<String>, Delegate)

Source:
EndpointRouteBuilderExtensions.cs

Adds a RouteEndpoint to the IEndpointRouteBuilder that matches HTTP requests for the specified HTTP methods and pattern.

C#
public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapMethods (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Collections.Generic.IEnumerable<string> httpMethods, Delegate handler);

Parameters

endpoints
IEndpointRouteBuilder

The IEndpointRouteBuilder to add the route to.

pattern
String

The route pattern.

httpMethods
IEnumerable<String>

HTTP methods that the endpoint will match.

handler
Delegate

The delegate executed when the endpoint is matched.

Returns

A RouteHandlerBuilder that can be used to further customize the endpoint.

Applies to

ASP.NET Core 9.0 dan versi lain
Produk Versi
ASP.NET Core 6.0, 7.0, 8.0, 9.0