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: - 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.
Return type: Returns: A reference to this instance after the operation has completed.
public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template)
- routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The
-
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: - 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.
Return type: Returns: A reference to this instance after the operation has completed.
public static IRouteBuilder MapRoute(this IRouteBuilder routeBuilder, string name, string template, object defaults)
- routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The
-
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: 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)
- routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The
-
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: 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)
- routeBuilder (Microsoft.AspNetCore.Routing.IRouteBuilder) – The
-