Share via


ConsumesAttribute Class

Definition

A filter that specifies the supported request content types. ContentTypes is used to select an action when there would otherwise be multiple matches.

[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
Inheritance
ConsumesAttribute
Attributes
Implements

Constructors

Fields

ConsumesActionConstraintOrder

The order for consumes attribute.

Properties

ContentTypes

Gets or sets the supported request content types. Used to select an action when there would otherwise be multiple matches.

IsOptional

Gets or sets a value that determines if the request body is optional. This value is only used to specify if the request body is required in API explorer.

Methods

Accept(ActionConstraintContext)

Determines whether an action is a valid candidate for selection.

OnResourceExecuted(ResourceExecutedContext)

Executes the resource filter. Called after execution of the remainder of the pipeline.

OnResourceExecuting(ResourceExecutingContext)

Executes the resource filter. Called before execution of the remainder of the pipeline.

SetContentTypes(MediaTypeCollection)

Configures a collection of allowed content types which can be consumed by the action.

Explicit Interface Implementations

Applies to