ConsumesAttribute Class

Summary

Specifies the allowed content types which can be used to select the action based on request’s content-type.

Syntax

public class ConsumesAttribute : Attribute, _Attribute, IResourceFilter, IFilter, IConsumesActionConstraint, IActionConstraint, IActionConstraintMetadata

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.ConsumesAttribute

Fields

ConsumesActionConstraintOrder()
public static readonly int ConsumesActionConstraintOrder

Constructors

ConsumesAttribute(System.String, System.String[])

Creates a new instance of [Microsoft.AspNet.Mvc.ConsumesAttribute](Microsoft.AspNet.Mvc.ConsumesAttribute.yml).

Arguments:
  • contentType (System.String) –
  • otherContentTypes (System.String[]) –
public ConsumesAttribute(string contentType, params string[] otherContentTypes)

Properties

ContentTypes()
Return type:System.Collections.Generic.IList{MediaTypeHeaderValue}
public IList<MediaTypeHeaderValue> ContentTypes { get; set; }
Order()
Return type:System.Int32
int IActionConstraint.Order { get; }

Methods

Accept(Microsoft.AspNet.Mvc.ActionConstraintContext)
Arguments:
Return type:

System.Boolean

public bool Accept(ActionConstraintContext context)
OnResourceExecuted(Microsoft.AspNet.Mvc.ResourceExecutedContext)
Arguments:
public void OnResourceExecuted(ResourceExecutedContext context)
OnResourceExecuting(Microsoft.AspNet.Mvc.ResourceExecutingContext)
Arguments:
public void OnResourceExecuting(ResourceExecutingContext context)