ApiConventionTypeAttribute 类

定义

要应用于包含 MVC 控制器或单个控制器的程序集的 API 约定。

API 约定用于影响 ApiExplorer 的输出。 约定必须是静态类型。 约定中的方法使用 指定的 ApiConventionNameMatchAttribute 规则与操作方法匹配,这些规则可应用于方法名称或其参数,并 ApiConventionTypeMatchAttribute 应用于参数。

如果找不到指定行为的属性,MVC 将匹配方法名称,并使用 Exact 匹配参数名称,并使用 AssignableFrom匹配参数类型。

public ref class ApiConventionTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ApiConventionTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)>]
type ApiConventionTypeAttribute = class
    inherit Attribute
Public NotInheritable Class ApiConventionTypeAttribute
Inherits Attribute
继承
ApiConventionTypeAttribute
属性

构造函数

ApiConventionTypeAttribute(Type)

ApiConventionTypeAttribute使用 conventionType初始化 实例。

属性

ConventionType

获取约定类型。

适用于