Table of Contents

Class CreatedAtRouteNegotiatedContentResult<T>

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

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

public class CreatedAtRouteNegotiatedContentResult<T> : IHttpActionResult

Type Parameters

T

The type of content in the entity body.

Inheritance
CreatedAtRouteNegotiatedContentResult<T>
Implements
Inherited Members

Constructors

CreatedAtRouteNegotiatedContentResult(string, IDictionary<string, object>, T, ApiController)

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

public CreatedAtRouteNegotiatedContentResult(string routeName, IDictionary<string, object> routeValues, T content, ApiController controller)

Parameters

routeName string

The name of the route to use for generating the URL.

routeValues IDictionary<string, object>

The route data to use for generating the URL.

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.

CreatedAtRouteNegotiatedContentResult(string, IDictionary<string, object>, T, UrlHelper, IContentNegotiator, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

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

public CreatedAtRouteNegotiatedContentResult(string routeName, IDictionary<string, object> routeValues, T content, UrlHelper urlFactory, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)

Parameters

routeName string

The name of the route to use for generating the URL.

routeValues IDictionary<string, object>

The route data to use for generating the URL.

content T

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

urlFactory UrlHelper

The factory to use to generate the route URL.

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.

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

RouteName

Gets the name of the route to use for generating the URL.

public string RouteName { get; }

Property Value

string

RouteValues

Gets the route data to use for generating the URL.

public IDictionary<string, object> RouteValues { get; }

Property Value

IDictionary<string, object>

UrlFactory

Gets the factory to use to generate the route URL.

public UrlHelper UrlFactory { get; }

Property Value

UrlHelper

Methods

ExecuteAsync(CancellationToken)

public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>