MapRouteRouteBuilderExtensions.MapRoute Method

Definition

Overloads

MapRoute(IRouteBuilder, String, String)

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

MapRoute(IRouteBuilder, String, String, Object)

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

MapRoute(IRouteBuilder, String, String, Object, Object)

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

MapRoute(IRouteBuilder, String, String, Object, Object, Object)

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

MapRoute(IRouteBuilder, String, String)

Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs

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

C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string template);
C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string? name, string? template);

Parameters

routeBuilder
IRouteBuilder

The IRouteBuilder to add the route to.

name
String

The name of the route.

template
String

The URL pattern of the route.

Returns

A reference to this instance after the operation has completed.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

MapRoute(IRouteBuilder, String, String, Object)

Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs

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

C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string template, object defaults);
C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string? name, string? template, object? defaults);

Parameters

routeBuilder
IRouteBuilder

The IRouteBuilder to add the route to.

name
String

The name of the route.

template
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.

Returns

A reference to this instance after the operation has completed.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

MapRoute(IRouteBuilder, String, String, Object, Object)

Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs

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

C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints);
C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string? name, string? template, object? defaults, object? constraints);

Parameters

routeBuilder
IRouteBuilder

The IRouteBuilder to add the route to.

name
String

The name of the route.

template
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.

Returns

A reference to this instance after the operation has completed.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

MapRoute(IRouteBuilder, String, String, Object, Object, Object)

Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs
Source:
MapRouteRouteBuilderExtensions.cs

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

C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string template, object defaults, object constraints, object dataTokens);
C#
public static Microsoft.AspNetCore.Routing.IRouteBuilder MapRoute (this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string? name, string? template, object? defaults, object? constraints, object? dataTokens);

Parameters

routeBuilder
IRouteBuilder

The IRouteBuilder to add the route to.

name
String

The name of the route.

template
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

A reference to this instance after the operation has completed.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0