DefaultStatusCodeAttribute Klasa

Definicja

Określa domyślny kod stanu skojarzony z elementem ActionResult.

public ref class DefaultStatusCodeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class DefaultStatusCodeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public sealed class DefaultStatusCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type DefaultStatusCodeAttribute = class
    inherit Attribute
Public NotInheritable Class DefaultStatusCodeAttribute
Inherits Attribute
Dziedziczenie
DefaultStatusCodeAttribute
Atrybuty

Uwagi

Ten atrybut jest tylko informacyjny i nie ma żadnych efektów środowiska uruchomieniowego. Zastosowanie atrybutu w klasie wskazuje, że ActionResult reprezentowany przez tę klasę domyślnie używa określonego kodu stanu. Zastosowanie atrybutu do metody wskazuje, że ActionResult metoda zwracana przez metodę domyślnie używa tego kodu stanu. Później przydaje się w scenariuszach, w których musimy określić, że metoda modyfikuje kod stanu używany ActionResult domyślnie w jego logice lub do określania kodu stanu do użycia w analizatorach interfejsu API.

Konstruktory

DefaultStatusCodeAttribute(Int32)

Inicjuje nowe wystąpienie klasy DefaultStatusCodeAttribute.

Właściwości

StatusCode

Pobiera domyślny kod stanu.

Dotyczy