語言

RouteAttribute 類別

定義

指定控制器上的屬性路由。

public ref class RouteAttribute : Attribute, Microsoft::AspNetCore::Mvc::Routing::IRouteTemplateProvider
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]
public class RouteAttribute : Attribute, Microsoft.AspNetCore.Mvc.Routing.IRouteTemplateProvider
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type RouteAttribute = class
    inherit Attribute
    interface IRouteTemplateProvider
Public Class RouteAttribute
Inherits Attribute
Implements IRouteTemplateProvider
繼承
RouteAttribute
屬性
實作

建構函式

名稱 Description
RouteAttribute(String)

使用指定的路由範本建立新的 RouteAttribute 。

屬性

名稱 Description
Name

取得路由名稱。 路由名稱可用來使用特定路由來產生連結,而不是依賴根據指定路由值的路由選取。

Order

取得路由順序。 順序會決定路由執行的順序。 系統會先嘗試具有較低順序值的路由。 如果動作藉由提供 IRouteTemplateProvider 非 null 順序來定義路由,則會使用該順序,而不是此值。 如果動作和控制器都未定義訂單,則會使用預設值 0。

Template

路由範本。 可以是 null。

明確介面實作

名稱 Description
IRouteTemplateProvider.Order

取得路由順序。 順序會決定路由執行的順序。 系統會先嘗試具有較低順序值的路由。 當路由未指定值時,它會取得預設值 0。 Order 屬性的 Null 值表示使用者未指定路由的明確順序。

適用於