MapRouteRouteBuilderExtensions Class

Provides extension methods for Microsoft.AspNetCore.Routing.IRouteBuilder to add routes.

Namespace
Microsoft.AspNetCore.Builder
Assemblies
  • Microsoft.AspNetCore.Routing

Syntax

public class MapRouteRouteBuilderExtensions
class Microsoft.AspNetCore.Builder.MapRouteRouteBuilderExtensions

Methods

MapRoute(Microsoft.AspNetCore.Routing.IRouteBuilder, System.String, System.String)

Adds a route to the Microsoft.AspNetCore.Routing.IRouteBuilder with the specified name and template.

Arguments:
Return type:

Microsoft.AspNetCore.Routing.IRouteBuilder

Returns:

A reference to this instance after the operation has completed.

public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template)
MapRoute(Microsoft.AspNetCore.Routing.IRouteBuilder, System.String, System.String, System.Object)

Adds a route to the Microsoft.AspNetCore.Routing.IRouteBuilder with the specified name, template, and default values.

Arguments:
Return type:

Microsoft.AspNetCore.Routing.IRouteBuilder

Returns:

A reference to this instance after the operation has completed.

public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template, object defaults)
MapRoute(Microsoft.AspNetCore.Routing.IRouteBuilder, System.String, System.String, System.Object, System.Object)

Adds a route to the Microsoft.AspNetCore.Routing.IRouteBuilder with the specified name, template, default values, and constraints.

Arguments:
  • routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The Microsoft.AspNetCore.Routing.IRouteBuilder to add the route to.
  • name (System.String) – The name of the route.
  • template (System.String) – The URL pattern of the route.
  • defaults (System.Object) – An object that contains default values for route parameters. The object’s properties represent the names and values of the default values.
  • constraints (System.Object) – An object that contains constraints for the route. The object’s properties represent the names and values of the constraints.
Return type:

Microsoft.AspNetCore.Routing.IRouteBuilder

Returns:

A reference to this instance after the operation has completed.

public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints)
MapRoute(Microsoft.AspNetCore.Routing.IRouteBuilder, System.String, System.String, System.Object, System.Object, System.Object)

Adds a route to the Microsoft.AspNetCore.Routing.IRouteBuilder with the specified name, template, default values, and data tokens.

Arguments:
  • routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The Microsoft.AspNetCore.Routing.IRouteBuilder to add the route to.
  • name (System.String) – The name of the route.
  • template (System.String) – The URL pattern of the route.
  • defaults (System.Object) – An object that contains default values for route parameters. The object’s properties represent the names and values of the default values.
  • constraints (System.Object) – An object that contains constraints for the route. The object’s properties represent the names and values of the constraints.
  • dataTokens (System.Object) – An object that contains data tokens for the route. The object’s properties represent the names and values of the data tokens.
Return type:

Microsoft.AspNetCore.Routing.IRouteBuilder

Returns:

A reference to this instance after the operation has completed.

public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints, object dataTokens)