Share via


ProducesErrorResponseTypeAttribute Sınıf

Tanım

ile ApiControllerAttributeek açıklama ekli denetleyiciler tarafından varsayılan olarak döndürülen türü belirtir.

Type hiçbir değer sağlanmazsa istemci hatası (HTTP Durum Kodu 4xx) için ile ProducesResponseTypeAttribute ilişkili hata modeli türünü belirtir. Değer belirtilmediğinde, istemci hataları (ClientErrorMapping) eşleniyorsa MVC, istemci hata türünü ProblemDetailsolarak kabul eder.

Uygulamanız yanıt vermek için özel bir hata türü kullanıyorsa, varsayılan hata türünü yapılandırmak için bunu Attribute kullanın.

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
Devralma
ProducesErrorResponseTypeAttribute
Öznitelikler

Oluşturucular

ProducesErrorResponseTypeAttribute(Type)

öğesinin yeni bir örneğini ProducesErrorResponseTypeAttributebaşlatır.

Özellikler

Type

Varsayılan hata türünü alır.

Şunlara uygulanır