ConsumesAttribute Class 
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A filter that specifies the supported request content types. ContentTypes is used to select an action when there would otherwise be multiple matches.
public ref class ConsumesAttribute : Attribute, Microsoft::AspNetCore::Mvc::ActionConstraints::IActionConstraint, Microsoft::AspNetCore::Mvc::ApiExplorer::IApiRequestMetadataProvider, Microsoft::AspNetCore::Mvc::Filters::IResourceFilter, Microsoft::AspNetCore::Mvc::Internal::IConsumesActionConstraintpublic 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 IApiRequestMetadataProviderPublic Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IConsumesActionConstraint, IResourceFilterPublic Class ConsumesAttribute
Inherits Attribute
Implements IAcceptsMetadata, IActionConstraint, IApiRequestMetadataProvider, IResourceFilterPublic Class ConsumesAttribute
Inherits Attribute
Implements IActionConstraint, IApiRequestMetadataProvider, IResourceFilter- Inheritance
- 
				ConsumesAttribute
- Attributes
- Implements
- 
		IActionConstraint IActionConstraintMetadata IApiRequestMetadataProvider IFilterMetadata IResourceFilter Microsoft.AspNetCore.Mvc.Internal.IConsumesActionConstraint IAcceptsMetadata
Constructors
| ConsumesAttribute(String, String[]) | Creates a new instance of ConsumesAttribute.<param name="contentType">The request content type.</param><param name="otherContentTypes">The additional list of allowed request content types.</param> | 
| ConsumesAttribute(Type, String, String[]) | Creates a new instance of ConsumesAttribute.<param name="requestType">The type being read from the request.</param><param name="contentType">The request content type.</param><param name="otherContentTypes">The additional list of allowed request content types.</param> | 
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
| IAcceptsMetadata.ContentTypes | |
| IAcceptsMetadata.RequestType | |
| IActionConstraint.Order | The constraint order. |