Dela via


ControllerEndpointRouteBuilderExtensions.MapControllerRoute Method

Definition

Adds endpoints for controller actions to the IEndpointRouteBuilder and specifies a route with the given name, pattern, defaults, constraints, and dataTokens.

public static Microsoft.AspNetCore.Builder.ControllerActionEndpointConventionBuilder MapControllerRoute (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string name, string pattern, object defaults = default, object constraints = default, object dataTokens = default);
public static Microsoft.AspNetCore.Builder.ControllerActionEndpointConventionBuilder MapControllerRoute (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string name, string pattern, object? defaults = default, object? constraints = default, object? dataTokens = default);
static member MapControllerRoute : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string * string * obj * obj * obj -> Microsoft.AspNetCore.Builder.ControllerActionEndpointConventionBuilder
<Extension()>
Public Function MapControllerRoute (endpoints As IEndpointRouteBuilder, name As String, pattern As String, Optional defaults As Object = Nothing, Optional constraints As Object = Nothing, Optional dataTokens As Object = Nothing) As ControllerActionEndpointConventionBuilder

Parameters

endpoints
IEndpointRouteBuilder

The IEndpointRouteBuilder to add the route to.

name
String

The name of the route.

pattern
String

The URL pattern of the route.

defaults
Object

An object that contains default values for route parameters. The object's properties represent the names and values of the default values.

constraints
Object

An object that contains constraints for the route. The object's properties represent the names and values of the constraints.

dataTokens
Object

An object that contains data tokens for the route. The object's properties represent the names and values of the data tokens.

Returns

An ControllerActionEndpointConventionBuilder for endpoints associated with controller actions for this route.

Applies to