ConsumesAttribute Classe

Definizione

Filtro che specifica i tipi di contenuto di richiesta supportati. ContentTypes viene usato per selezionare un'azione quando in caso contrario sarebbero presenti più corrispondenze.

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
Ereditarietà
ConsumesAttribute
Attributi
Implementazioni

Costruttori

Nome Descrizione
ConsumesAttribute(String, String[])

Crea una nuova istanza di ConsumesAttribute.

ConsumesAttribute(Type, String, String[])

Crea una nuova istanza di ConsumesAttribute.

Campi

Nome Descrizione
ConsumesActionConstraintOrder

Ordine di utilizzo dell'attributo.

Proprietà

Nome Descrizione
ContentTypes

Ottiene o imposta i tipi di contenuto della richiesta supportati. Usato per selezionare un'azione quando in caso contrario sarebbero presenti più corrispondenze.

IsOptional

Ottiene o imposta un valore che determina se il corpo della richiesta è facoltativo. Questo valore viene usato solo per specificare se il corpo della richiesta è necessario in Esplora API.

Metodi

Nome Descrizione
Accept(ActionConstraintContext)

Determina se un'azione è un candidato valido per la selezione.

OnResourceExecuted(ResourceExecutedContext)

Esegue il filtro delle risorse. Chiamato dopo l'esecuzione del resto della pipeline.

OnResourceExecuting(ResourceExecutingContext)

Esegue il filtro delle risorse. Chiamato prima dell'esecuzione del resto della pipeline.

SetContentTypes(MediaTypeCollection)

Configura una raccolta di tipi di contenuto consentiti che possono essere utilizzati dall'azione.

Implementazioni dell'interfaccia esplicita

Nome Descrizione
IAcceptsMetadata.ContentTypes

Filtro che specifica i tipi di contenuto di richiesta supportati. ContentTypes viene usato per selezionare un'azione quando in caso contrario sarebbero presenti più corrispondenze.

IAcceptsMetadata.RequestType

Filtro che specifica i tipi di contenuto di richiesta supportati. ContentTypes viene usato per selezionare un'azione quando in caso contrario sarebbero presenti più corrispondenze.

IActionConstraint.Order

Ordine dei vincoli.

Si applica a