Table of Contents

Class CreatedNegotiatedContentResult<T>

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

Represents an action result that performs content negotiation and returns a Created response when it succeeds.

public class CreatedNegotiatedContentResult<T> : IHttpActionResult

Type Parameters

T

The type of content in the entity body.

Inheritance
CreatedNegotiatedContentResult<T>
Implements
Inherited Members

Constructors

CreatedNegotiatedContentResult(Uri, T, IContentNegotiator, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

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

public CreatedNegotiatedContentResult(Uri location, T content, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)

Parameters

location Uri

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

content T

The location at which the content has been created.

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.

CreatedNegotiatedContentResult(Uri, T, ApiController)

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

public CreatedNegotiatedContentResult(Uri location, T content, ApiController controller)

Parameters

location Uri

The location at which the content has been created.

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

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

ContentNegotiator

Gets the content negotiator to handle content negotiation.

public IContentNegotiator ContentNegotiator { get; }

Property Value

IContentNegotiator

The content negotiator to handle content negotiation.

Formatters

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

public IEnumerable<MediaTypeFormatter> Formatters { get; }

Property Value

IEnumerable<MediaTypeFormatter>

The formatters to use to negotiate and format the content.

Location

Gets the location at which the content has been created.

public Uri Location { get; }

Property Value

Uri

The location at which the content has been created.

Request

Gets the request message which led to this result.

public HttpRequestMessage Request { get; }

Property Value

HttpRequestMessage

The HTTP request message which led to this result.

Methods

ExecuteAsync(CancellationToken)

Executes asynchronously the operation of the created negotiated content result.

public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task<HttpResponseMessage>

Asynchronously executes a return value.