Dela via


ProducesAttribute<T> 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 class ProducesAttribute<T> : Microsoft.AspNetCore.Mvc.ProducesAttribute
type ProducesAttribute<'T> = class
    inherit ProducesAttribute
Public Class ProducesAttribute(Of T)
Inherits ProducesAttribute

Type Parameters

T

The Type of object that is going to be written in the response.

Inheritance
ProducesAttribute<T>

Remarks

This is a derived generic variant of the ProducesAttribute. Ensure that only one instance of either attribute is provided on the target.

Constructors

ProducesAttribute<T>()

Initializes an instance of ProducesAttribute.

Properties

ContentTypes

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

(Inherited from ProducesAttribute)
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 ProducesAttribute)
StatusCode

Gets the HTTP status code of the response.

(Inherited from ProducesAttribute)
Type

Gets the optimistic return type of the action.

(Inherited from ProducesAttribute)

Methods

OnResultExecuted(ResultExecutedContext)

Called after the action result executes.

(Inherited from ProducesAttribute)
OnResultExecuting(ResultExecutingContext)

Called before the action result executes.

(Inherited from ProducesAttribute)
SetContentTypes(MediaTypeCollection)

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

(Inherited from ProducesAttribute)

Applies to