ProducesErrorResponseTypeAttribute 类

定义

指定默认由使用 批注的 ApiControllerAttribute控制器返回的类型。

Type 未提供任何值时,为客户端错误指定与 ProducesResponseTypeAttribute 关联的错误模型类型, (HTTP 状态代码 4xx) 。 如果未指定任何值,则 MVC 假定客户端错误类型为 ProblemDetails,如果使用映射客户端错误 (ClientErrorMapping) 。

Attribute如果应用程序使用自定义错误类型进行响应,则使用此配置默认错误类型。

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

构造函数

ProducesErrorResponseTypeAttribute(Type)

初始化 ProducesErrorResponseTypeAttribute 的新实例。

属性

Type

获取默认错误类型。

适用于