RouteValueAttribute 類別

定義

屬性,指定動作或控制器的必要路由值。

在動作上放置時,要求的路由資料必須符合所需路由資料的預期,才能選取動作。 除非要求的路由資料省略符合索引鍵的值,否則無法選取沒有指定索引鍵之路由值的其他所有動作。 如需詳細資料和範例,請參閱 IRouteValueProvider

在控制器上放置時,除非由動作覆寫,否則條件約束會套用至控制器所定義的所有動作。

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

建構函式

RouteValueAttribute(String, String)

建立新的 RouteValueAttribute

屬性

RouteKey

路由值索引鍵。

RouteValue

路由值。 如果 null 為 或 空白,則需要與 RouteKey 相關聯的路由值遺失或 null

適用於