Dela via


ProducesAttribute Class

Definition

A filter that specifies the expected Type the action will return and the supported response content types. The ContentTypes value is used to set 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
Inheritance
ProducesAttribute
Inheritance
ProducesAttribute
Derived
Attributes
Implements

Constructors

ProducesAttribute(String, String[])

Initializes an instance of ProducesAttribute with allowed content types.

ProducesAttribute(Type)

Initializes an instance of ProducesAttribute.

Properties

ContentTypes

Gets or sets the supported response content types. Used to set ContentTypes.

Order

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

Order

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

(Inherited from ResultFilterAttribute)
StatusCode

Gets the HTTP status code of the response.

Type

Gets the optimistic return type of the action.

Methods

OnResultExecuted(ResultExecutedContext)

Called after the action result executes.

OnResultExecuted(ResultExecutedContext)

Called after the action result executes.

(Inherited from ResultFilterAttribute)
OnResultExecuting(ResultExecutingContext)

Called before the action result executes.

OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate)

Called asynchronously before the action result.

(Inherited from ResultFilterAttribute)
SetContentTypes(MediaTypeCollection)

Configures a collection of allowed content types which can be produced by the action.

Applies to