ConsumesAttribute Třída

Definice

Filtr, který určuje podporované typy obsahu požadavků. ContentTypes slouží k výběru akce v případě, že by jinak bylo více shod.

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.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.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)>]
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 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
[<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
Public Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IConsumesActionConstraint, IResourceFilter
Public Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IResourceFilter
Public Class ConsumesAttribute
Inherits Attribute
Implements IAcceptsMetadata, IActionConstraint, IApiRequestMetadataProvider, IResourceFilter
Dědičnost
ConsumesAttribute
Atributy
Implementuje

Konstruktory

ConsumesAttribute(String, String[])

Vytvoří novou instanci položky ConsumesAttribute. Typ obsahu žádostiDalší seznam povolených typů obsahu žádosti.

ConsumesAttribute(Type, String, String[])

Vytvoří novou instanci položky ConsumesAttribute. Typ, který se čte z požadavku.Typ obsahu žádostiDalší seznam povolených typů obsahu žádosti.

Pole

ConsumesActionConstraintOrder

Pořadí pro využití atributu.

Vlastnosti

ContentTypes

Získá nebo nastaví podporované typy obsahu požadavků. Slouží k výběru akce v případě, že by jinak bylo více shod.

IsOptional

Získává nebo nastavuje hodnotu, která určuje, jestli je text požadavku nepovinný. Tato hodnota se používá pouze k určení, zda je v Průzkumníkovi rozhraní API vyžadován text požadavku.

Metody

Accept(ActionConstraintContext)

Určuje, zda je akce platným kandidátem pro výběr.

OnResourceExecuted(ResourceExecutedContext)

Spustí filtr prostředků. Volá se po spuštění zbytku kanálu.

OnResourceExecuting(ResourceExecutingContext)

Spustí filtr prostředků. Volá se před provedením zbytku kanálu.

SetContentTypes(MediaTypeCollection)

Nakonfiguruje kolekci povolených typů obsahu, které může tato akce spotřebovat.

Explicitní implementace rozhraní

IAcceptsMetadata.ContentTypes
IAcceptsMetadata.RequestType
IActionConstraint.Order

Pořadí omezení

Platí pro