RouteAttribute Class

Specifies an attribute route on a controller.

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RouteAttribute : Attribute, _Attribute, IRouteTemplateProvider
class Microsoft.AspNetCore.Mvc.RouteAttribute

Constructors

RouteAttribute(System.String)

Creates a new Microsoft.AspNetCore.Mvc.RouteAttribute with the given route template.

Arguments:template (System.String) – The route template. May not be null.
public RouteAttribute(string template)

Properties

Microsoft.AspNetCore.Mvc.RouteAttribute.Order
Return type:System.Nullable<System.Int32>
int ? IRouteTemplateProvider.Order { get; }
Microsoft.AspNetCore.Mvc.RouteAttribute.Name
Return type:System.String
public string Name { get; set; }
Microsoft.AspNetCore.Mvc.RouteAttribute.Order

Gets the route order. The order determines the order of route execution. Routes with a lower order value are tried first. If an action defines a route by providing an Microsoft.AspNetCore.Mvc.Routing.IRouteTemplateProvider with a non <code>null</code> order, that order is used instead of this value. If neither the action nor the controller defines an order, a default value of 0 is used.

Return type:System.Int32
public int Order { get; set; }
Microsoft.AspNetCore.Mvc.RouteAttribute.Template
Return type:System.String
public string Template { get; }