Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ProducesAttribute Class
Definition
- Namespace:
- Microsoft.AspNetCore.Mvc
- Assembly:
- Microsoft.AspNetCore.Mvc.Core.dll
- Package:
- Microsoft.AspNetCore.Mvc.Core v1.0.0
- Package:
- Microsoft.AspNetCore.Mvc.Core v1.1.0
- Package:
- Microsoft.AspNetCore.App.Ref v10.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
- Package:
- Microsoft.AspNetCore.Mvc.Core v2.0.0
- Package:
- Microsoft.AspNetCore.Mvc.Core v2.1.0
- Package:
- Microsoft.AspNetCore.Mvc.Core v2.2.0
- Package:
- Microsoft.AspNetCore.App.Ref v3.0.1
- Package:
- Microsoft.AspNetCore.App.Ref v3.1.10
- Package:
- Microsoft.AspNetCore.App.Ref v5.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v6.0.36
- Package:
- Microsoft.AspNetCore.App.Ref v7.0.5
- Package:
- Microsoft.AspNetCore.App.Ref v8.0.19
- Package:
- Microsoft.AspNetCore.App.Ref v9.0.8
- Source:
- ProducesAttribute.cs
- Source:
- ProducesAttribute.cs
- Source:
- ProducesAttribute.cs
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- Inheritance
-
ProducesAttribute
- Derived
- Attributes
- Implements
Constructors
| Name | Description |
|---|---|
| ProducesAttribute(String, String[]) |
Initializes an instance of ProducesAttribute with allowed content types. |
| ProducesAttribute(Type) |
Initializes an instance of ProducesAttribute. |
Properties
| Name | Description |
|---|---|
| ContentTypes |
Gets or sets the supported response content types. Used to set ContentTypes. |
| Description |
Gets the description of the response. |
| 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
| Name | Description |
|---|---|
| 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
Feedback
Was this page helpful?
