Table of Contents

Class OkNegotiatedContentResult<T>

Namespace
System.Web.Http.Results
Assembly
System.Web.Http.dll

Represents an action result that performs content negotiation and returns an HttpStatusCode.OK response when it succeeds.

public class OkNegotiatedContentResult<T> : IHttpActionResult

Type Parameters

T

The type of content in the entity body.

Inheritance
OkNegotiatedContentResult<T>
Implements
Inherited Members

Constructors

OkNegotiatedContentResult(T, IContentNegotiator, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

Initializes a new instance of the OkNegotiatedContentResult<T> class with the values provided.

public OkNegotiatedContentResult(T content, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)

Parameters

content T

The content value to negotiate and format in the entity body.

contentNegotiator IContentNegotiator

The content negotiator to handle content negotiation.

request HttpRequestMessage

The request message which led to this result.

formatters IEnumerable<MediaTypeFormatter>

The formatters to use to negotiate and format the content.

OkNegotiatedContentResult(T, ApiController)

Initializes a new instance of the OkNegotiatedContentResult<T> class with the values provided.

public OkNegotiatedContentResult(T content, ApiController controller)

Parameters

content T

The content value to negotiate and format in the entity body.

controller ApiController

The controller from which to obtain the dependencies needed for execution.

Properties

Content

Gets the content value to negotiate and format in the entity body.

public T Content { get; }

Property Value

T

ContentNegotiator

Gets the content negotiator to handle content negotiation.

public IContentNegotiator ContentNegotiator { get; }

Property Value

IContentNegotiator

Formatters

Gets the formatters to use to negotiate and format the content.

public IEnumerable<MediaTypeFormatter> Formatters { get; }

Property Value

IEnumerable<MediaTypeFormatter>

Request

Gets the request message which led to this result.

public HttpRequestMessage Request { get; }

Property Value

HttpRequestMessage

Methods

ExecuteAsync(CancellationToken)

public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>