ConsumesAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
一个筛选器,指定受支持的请求内容类型。 ContentTypes 当存在多个匹配项时,用于选择操作。
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
- 继承
-
ConsumesAttribute
- 属性
- 实现
-
IActionConstraint IActionConstraintMetadata IApiRequestMetadataProvider IFilterMetadata IResourceFilter Microsoft.AspNetCore.Mvc.Internal.IConsumesActionConstraint IAcceptsMetadata
构造函数
ConsumesAttribute(String, String[]) |
创建 ConsumesAttribute 的新实例。 |
ConsumesAttribute(Type, String, String[]) |
创建 ConsumesAttribute 的新实例。 |
字段
ConsumesActionConstraintOrder |
使用属性的顺序。 |
属性
ContentTypes |
获取或设置支持的请求内容类型。 当存在多个匹配项时,用于选择操作。 |
IsOptional |
获取或设置一个值,该值确定请求正文是否是可选的。 此值仅用于指定 API 资源管理器中是否需要请求正文。 |
方法
Accept(ActionConstraintContext) |
确定操作是否是所选内容的有效候选项。 |
OnResourceExecuted(ResourceExecutedContext) |
执行资源筛选器。 在执行管道的其余部分后调用。 |
OnResourceExecuting(ResourceExecutingContext) |
执行资源筛选器。 在执行管道的其余部分之前调用。 |
SetContentTypes(MediaTypeCollection) |
配置允许的内容类型集合,该内容类型可由操作使用。 |
显式接口实现
IAcceptsMetadata.ContentTypes |
一个筛选器,指定受支持的请求内容类型。 ContentTypes 当存在多个匹配项时,用于选择操作。 |
IAcceptsMetadata.RequestType |
一个筛选器,指定受支持的请求内容类型。 ContentTypes 当存在多个匹配项时,用于选择操作。 |
IActionConstraint.Order |
约束顺序。 |