Class FormattedContentResult<T>
Represents an action result that returns formatted content.
public class FormattedContentResult<T> : IHttpActionResult
Type Parameters
TThe 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
statusCodeHttpStatusCodeThe HTTP status code for the response message.
contentTThe content value to format in the entity body.
formatterMediaTypeFormatterThe formatter to use to format the content.
mediaTypeMediaTypeHeaderValueThe value for the Content-Type header, or
to have the formatter pick a default value. requestHttpRequestMessageThe 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
statusCodeHttpStatusCodeThe HTTP status code for the response message.
contentTThe content value to format in the entity body.
formatterMediaTypeFormatterThe formatter to use to format the content.
mediaTypeMediaTypeHeaderValueThe value for the Content-Type header, or
to have the formatter pick a default value. controllerApiControllerThe 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
cancellationTokenCancellationToken