MvcOptions.SuppressAsyncSuffixInActionNames 屬性

定義

取得或設定值,判斷 MVC 是否會移除套用至控制器動作名稱的尾碼 「Async」。

ActionName 用來建構動作的路由,以及在檢視查閱中。 當 時 true ,MVC 會修剪套用至動作方法名稱的尾碼 「Async」。 例如,的動作名稱 ProductsController.ListProductsAsync 將會正式化為 ListProducts. 。 因此,其可透過查閱 的 /Views/Products/ListProducts.cshtml 檢視來路由 /Products/ListProducts 傳送。

此選項不會影響使用 ActionNameAttribute 指定的值。

public:
 property bool SuppressAsyncSuffixInActionNames { bool get(); void set(bool value); };
public bool SuppressAsyncSuffixInActionNames { get; set; }
member this.SuppressAsyncSuffixInActionNames : bool with get, set
Public Property SuppressAsyncSuffixInActionNames As Boolean

屬性值

預設值是 true

適用於