ConsumesAttribute Sınıf

Tanım

Desteklenen istek içerik türlerini belirten bir filtre. ContentTypes , aksi takdirde birden fazla eşleşme olması durumunda bir eylem seçmek için kullanılır.

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
Devralma
ConsumesAttribute
Öznitelikler
Uygulamalar

Oluşturucular

ConsumesAttribute(String, String[])

ConsumesAttribute öğesinin yeni bir örneğini oluşturur.

ConsumesAttribute(Type, String, String[])

ConsumesAttribute öğesinin yeni bir örneğini oluşturur.

Alanlar

ConsumesActionConstraintOrder

Tüketir özniteliği için sıra.

Özellikler

ContentTypes

Desteklenen istek içerik türlerini alır veya ayarlar. Aksi halde birden fazla eşleşme olması durumunda bir eylem seçmek için kullanılır.

IsOptional

İstek gövdesinin isteğe bağlı olup olmadığını belirleyen bir değer alır veya ayarlar. Bu değer yalnızca, istek gövdesinin API Explorer 'da gerekli olup olmadığını belirtmek için kullanılır.

Yöntemler

Accept(ActionConstraintContext)

Bir eylemin seçim için geçerli bir aday olup olmadığını belirler.

OnResourceExecuted(ResourceExecutedContext)

Kaynak filtresini yürütür. İşlem hattının geri kalanı yürütülmeden sonra çağırılır.

OnResourceExecuting(ResourceExecutingContext)

Kaynak filtresini yürütür. İşlem hattının geri kalanı yürütülmeden önce çağırılır.

SetContentTypes(MediaTypeCollection)

Eylem tarafından tüketilen, izin verilen bir içerik türleri koleksiyonunu yapılandırır.

Belirtik Arabirim Kullanımları

IAcceptsMetadata.ContentTypes
IAcceptsMetadata.RequestType
IActionConstraint.Order

Kısıtlama sırası.

Şunlara uygulanır