Język

ConsumesAttribute Klasa

Definicja

Filtr określający obsługiwane typy zawartości żądania. ContentTypes służy do wybierania akcji, gdy w przeciwnym razie będzie wiele dopasowań.

public ref class ConsumesAttribute : Attribute, Microsoft::AspNetCore::Mvc::ActionConstraints::IActionConstraint, Microsoft::AspNetCore::Mvc::ApiExplorer::IApiRequestMetadataProvider, Microsoft::AspNetCore::Mvc::Filters::IResourceFilter, Microsoft::AspNetCore::Mvc::Internal::IConsumesActionConstraint
public ref class ConsumesAttribute : Attribute, Microsoft::AspNetCore::Mvc::ActionConstraints::IActionConstraint, Microsoft::AspNetCore::Mvc::ApiExplorer::IApiRequestMetadataProvider, Microsoft::AspNetCore::Mvc::Filters::IResourceFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ConsumesAttribute : Attribute, Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestMetadataProvider, Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Internal.IConsumesActionConstraint
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ConsumesAttribute : Attribute, Microsoft.AspNetCore.Http.Metadata.IAcceptsMetadata, Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestMetadataProvider, Microsoft.AspNetCore.Mvc.Filters.IResourceFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ConsumesAttribute : Attribute, Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestMetadataProvider, Microsoft.AspNetCore.Mvc.Filters.IResourceFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ConsumesAttribute = class
    inherit Attribute
    interface IResourceFilter
    interface IFilterMetadata
    interface IConsumesActionConstraint
    interface IActionConstraint
    interface IActionConstraintMetadata
    interface IApiRequestMetadataProvider
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ConsumesAttribute = class
    inherit Attribute
    interface IResourceFilter
    interface IFilterMetadata
    interface IActionConstraint
    interface IActionConstraintMetadata
    interface IApiRequestMetadataProvider
    interface IAcceptsMetadata
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ConsumesAttribute = class
    inherit Attribute
    interface IActionConstraint
    interface IActionConstraintMetadata
    interface IApiRequestMetadataProvider
    interface IFilterMetadata
    interface IResourceFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ConsumesAttribute = class
    inherit Attribute
    interface IResourceFilter
    interface IFilterMetadata
    interface IActionConstraint
    interface IActionConstraintMetadata
    interface IApiRequestMetadataProvider
Public Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IConsumesActionConstraint, IResourceFilter
Public Class ConsumesAttribute
Inherits Attribute
Implements IAcceptsMetadata, IActionConstraint, IApiRequestMetadataProvider, IResourceFilter
Public Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IResourceFilter
Dziedziczenie
ConsumesAttribute
Atrybuty
Implementuje

Konstruktory

Nazwa Opis
ConsumesAttribute(String, String[])

Tworzy nowe wystąpienie klasy ConsumesAttribute.

ConsumesAttribute(Type, String, String[])

Tworzy nowe wystąpienie klasy ConsumesAttribute.

Pola

Nazwa Opis
ConsumesActionConstraintOrder

Kolejność dla atrybutu consumes.

Właściwości

Nazwa Opis
ContentTypes

Pobiera lub ustawia obsługiwane typy zawartości żądania. Służy do wybierania akcji, gdy w przeciwnym razie będzie wiele dopasowań.

IsOptional

Pobiera lub ustawia wartość, która określa, czy treść żądania jest opcjonalna. Ta wartość jest używana tylko do określenia, czy treść żądania jest wymagana w Eksploratorze interfejsu API.

Metody

Nazwa Opis
Accept(ActionConstraintContext)

Określa, czy akcja jest prawidłowym kandydatem do wyboru.

OnResourceExecuted(ResourceExecutedContext)

Wykonuje filtr zasobów. Wywoływane po wykonaniu pozostałej części potoku.

OnResourceExecuting(ResourceExecutingContext)

Wykonuje filtr zasobów. Wywołana przed wykonaniem pozostałej części potoku.

SetContentTypes(MediaTypeCollection)

Konfiguruje kolekcję dozwolonych typów zawartości, które mogą być używane przez akcję.

Jawne implementacje interfejsu

Nazwa Opis
IAcceptsMetadata.ContentTypes

Filtr określający obsługiwane typy zawartości żądania. ContentTypes służy do wybierania akcji, gdy w przeciwnym razie będzie wiele dopasowań.

IAcceptsMetadata.RequestType

Filtr określający obsługiwane typy zawartości żądania. ContentTypes służy do wybierania akcji, gdy w przeciwnym razie będzie wiele dopasowań.

IActionConstraint.Order

Kolejność ograniczeń.

Dotyczy