Class FormattedContentResult<T>
Represents an action result that returns formatted content.
public class FormattedContentResult<T> : IHttpActionResult
Type Parameters
T
The type of content in the entity body.
- Inheritance
-
FormattedContentResult<T>
- Implements
- Inherited Members
Constructors
FormattedContentResult(HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue, HttpRequestMessage)
Initializes a new instance of the FormattedContentResult<T> class with the values provided.
public FormattedContentResult(HttpStatusCode statusCode, T content, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, HttpRequestMessage request)
Parameters
statusCode
HttpStatusCodeThe HTTP status code for the response message.
content
TThe content value to format in the entity body.
formatter
MediaTypeFormatterThe formatter to use to format the content.
mediaType
MediaTypeHeaderValueThe value for the Content-Type header, or
to have the formatter pick a default value. request
HttpRequestMessageThe request message which led to this result.
FormattedContentResult(HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue, ApiController)
Initializes a new instance of the FormattedContentResult<T> class with the values provided.
public FormattedContentResult(HttpStatusCode statusCode, T content, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, ApiController controller)
Parameters
statusCode
HttpStatusCodeThe HTTP status code for the response message.
content
TThe content value to format in the entity body.
formatter
MediaTypeFormatterThe formatter to use to format the content.
mediaType
MediaTypeHeaderValueThe value for the Content-Type header, or
to have the formatter pick a default value. controller
ApiControllerThe controller from which to obtain the dependencies needed for execution.
Properties
Content
Gets the content value to format in the entity body.
public T Content { get; }
Property Value
- T
Formatter
Gets the formatter to use to format the content.
public MediaTypeFormatter Formatter { get; }
Property Value
- MediaTypeFormatter
MediaType
Gets the value for the Content-Type header, or
public MediaTypeHeaderValue MediaType { get; }
Property Value
Request
Gets the request message which led to this result.
public HttpRequestMessage Request { get; }
Property Value
StatusCode
Gets the HTTP status code for the response message.
public HttpStatusCode StatusCode { get; }
Property Value
Methods
ExecuteAsync(CancellationToken)
public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken