ProducesAttribute 類別

定義

指定動作會傳回的預期 Type 篩選,以及支援的回應內容類型。 值 ContentTypes 是用來設定 ContentTypes

public ref class ProducesAttribute : Microsoft::AspNetCore::Mvc::Filters::ResultFilterAttribute, Microsoft::AspNetCore::Mvc::ApiExplorer::IApiResponseMetadataProvider
public ref class ProducesAttribute : Attribute, Microsoft::AspNetCore::Mvc::ApiExplorer::IApiResponseMetadataProvider, Microsoft::AspNetCore::Mvc::Filters::IOrderedFilter, Microsoft::AspNetCore::Mvc::Filters::IResultFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ProducesAttribute : Microsoft.AspNetCore.Mvc.Filters.ResultFilterAttribute, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiResponseMetadataProvider
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ProducesAttribute : Attribute, Microsoft.AspNetCore.Mvc.ApiExplorer.IApiResponseMetadataProvider, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ProducesAttribute = class
    inherit ResultFilterAttribute
    interface IApiResponseMetadataProvider
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ProducesAttribute = class
    inherit ResultFilterAttribute
    interface IApiResponseMetadataProvider
    interface IFilterMetadata
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ProducesAttribute = class
    inherit Attribute
    interface IResultFilter
    interface IFilterMetadata
    interface IOrderedFilter
    interface IApiResponseMetadataProvider
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ProducesAttribute = class
    inherit Attribute
    interface IApiResponseMetadataProvider
    interface IFilterMetadata
    interface IOrderedFilter
    interface IResultFilter
Public Class ProducesAttribute
Inherits ResultFilterAttribute
Implements IApiResponseMetadataProvider
Public Class ProducesAttribute
Inherits Attribute
Implements IApiResponseMetadataProvider, IOrderedFilter, IResultFilter
繼承
ProducesAttribute
繼承
ProducesAttribute
衍生
屬性
實作

建構函式

ProducesAttribute(String, String[])

使用允許的內容類型,初始化 的 ProducesAttribute 實例。

ProducesAttribute(Type)

初始化 ProducesAttribute 的執行個體。

屬性

ContentTypes

取得或設定支援的回應內容類型。 用來設定 ContentTypes

Order

取得決定篩選準則執行順序的順序值。 篩選會以屬性的 Order 遞增數值執行。

Order

取得決定篩選準則執行順序的順序值。 篩選會以屬性的 Order 遞增數值執行。

(繼承來源 ResultFilterAttribute)
StatusCode

取得回應的 HTTP 狀態碼。

Type

取得動作的開放式傳回型別。

方法

OnResultExecuted(ResultExecutedContext)

在動作結果執行之後呼叫。

OnResultExecuted(ResultExecutedContext)

在動作結果執行之後呼叫。

(繼承來源 ResultFilterAttribute)
OnResultExecuting(ResultExecutingContext)

在動作結果執行之前呼叫。

OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate)

在動作結果之前以非同步方式呼叫。

(繼承來源 ResultFilterAttribute)
SetContentTypes(MediaTypeCollection)

設定允許的內容類型集合,這些內容類型可由動作產生。

適用於