ConsumesAttribute Class¶
A filter that specifies the supported request content types. Microsoft.AspNetCore.Mvc.ConsumesAttribute.ContentTypes
is used to select an
action when there would otherwise be multiple matches.
- Namespace
Microsoft.AspNetCore.Mvc
- Assemblies
- Microsoft.AspNetCore.Mvc.Core
Inheritance Hierarchy¶
System.Object
System.Attribute
Microsoft.AspNetCore.Mvc.ConsumesAttribute
Syntax¶
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ConsumesAttribute : Attribute, _Attribute, IResourceFilter, IFilterMetadata, IConsumesActionConstraint, IActionConstraint, IActionConstraintMetadata, IApiRequestMetadataProvider
-
class
Microsoft.AspNetCore.Mvc.
ConsumesAttribute
Constructors¶
-
ConsumesAttribute
(System.String, System.String[])¶ Creates a new instance of
Microsoft.AspNetCore.Mvc.ConsumesAttribute
.public ConsumesAttribute(string contentType, params string[] otherContentTypes)
-
Methods¶
-
Accept
(Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintContext)¶ Return type: System.Boolean public bool Accept(ActionConstraintContext context)
-
OnResourceExecuted
(Microsoft.AspNetCore.Mvc.Filters.ResourceExecutedContext)¶ public void OnResourceExecuted(ResourceExecutedContext context)
-
OnResourceExecuting
(Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext)¶ public void OnResourceExecuting(ResourceExecutingContext context)
-
SetContentTypes
(Microsoft.AspNetCore.Mvc.Formatters.MediaTypeCollection)¶ public void SetContentTypes(MediaTypeCollection contentTypes)
-
Fields¶
-
ConsumesActionConstraintOrder
()¶ Return type: System.Int32 public static readonly int ConsumesActionConstraintOrder
-
Properties¶
-
Microsoft.AspNetCore.Mvc.ConsumesAttribute.
ContentTypes
¶ Gets or sets the supported request content types. Used to select an action when there would otherwise be multiple matches.
Return type: Microsoft.AspNetCore.Mvc.Formatters.MediaTypeCollection public MediaTypeCollection ContentTypes { get; set; }
-
Microsoft.AspNetCore.Mvc.ConsumesAttribute.
Order
¶ Return type: System.Int32 int IActionConstraint.Order { get; }
-