HttpMethodAttribute 类

定义

标识支持一组给定 HTTP 方法的操作。

public ref class HttpMethodAttribute abstract : Attribute, Microsoft::AspNetCore::Mvc::Routing::IActionHttpMethodProvider, Microsoft::AspNetCore::Mvc::Routing::IRouteTemplateProvider
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]
public abstract class HttpMethodAttribute : Attribute, Microsoft.AspNetCore.Mvc.Routing.IActionHttpMethodProvider, Microsoft.AspNetCore.Mvc.Routing.IRouteTemplateProvider
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type HttpMethodAttribute = class
    inherit Attribute
    interface IActionHttpMethodProvider
    interface IRouteTemplateProvider
Public MustInherit Class HttpMethodAttribute
Inherits Attribute
Implements IActionHttpMethodProvider, IRouteTemplateProvider
继承
HttpMethodAttribute
派生
属性
实现

构造函数

HttpMethodAttribute(IEnumerable<String>)

HttpMethodAttribute使用给定的 HTTP 方法集创建新的方法。

HttpMethodAttribute(IEnumerable<String>, String)

使用给定的 HTTP 方法集创建一个新 HttpMethodAttribute 路由模板。

属性

HttpMethods

此操作提供程序支持的 http 方法列表。

Name

获取路由名称。 路由名称可用于使用特定路由生成链接,而不是依赖于基于给定路由值的路由集选择路由。

Order

获取路由顺序。 该顺序确定路由执行的顺序。 首先尝试具有较低顺序值的路由。 当路由未指定值时,如果RouteAttribute控制器上未定义值,则获取Order默认值为 0 的值。

Template

路由模板。 可为 null

显式接口实现

IRouteTemplateProvider.Order

获取路由顺序。 该顺序确定路由执行的顺序。 首先尝试具有较低顺序值的路由。 当路由未指定值时,它将获取默认值 0。 Order 属性的 null 值表示用户未为路由指定显式顺序。

适用于