Table of Contents

Class ODataPathRouteConstraint

Namespace
System.Web.Http.OData.Routing
Assembly
System.Web.Http.OData.dll

An implementation of System.Web.Http.Routing.IHttpRouteConstraint that only matches OData paths.

public class ODataPathRouteConstraint : IHttpRouteConstraint
Inheritance
ODataPathRouteConstraint
Implements
IHttpRouteConstraint
Inherited Members

Constructors

ODataPathRouteConstraint(IODataPathHandler, IEdmModel, string, IEnumerable<IODataRoutingConvention>)

Initializes a new instance of the ODataPathRouteConstraint class.

public ODataPathRouteConstraint(IODataPathHandler pathHandler, IEdmModel model, string routeName, IEnumerable<IODataRoutingConvention> routingConventions)

Parameters

pathHandler IODataPathHandler

The OData path handler to use for parsing.

model IEdmModel

The EDM model to use for parsing the path.

routeName string

The name of the route this constraint is associated with.

routingConventions IEnumerable<IODataRoutingConvention>

The OData routing conventions to use for selecting the controller name.

Properties

EdmModel

Gets the EDM model to use for parsing the path.

public IEdmModel EdmModel { get; }

Property Value

IEdmModel

PathHandler

Gets the OData path handler to use for parsing.

public IODataPathHandler PathHandler { get; }

Property Value

IODataPathHandler

RouteName

Gets the name of the route this constraint is associated with.

public string RouteName { get; }

Property Value

string

RoutingConventions

Gets the OData routing conventions to use for selecting the controller name.

public IEnumerable<IODataRoutingConvention> RoutingConventions { get; }

Property Value

IEnumerable<IODataRoutingConvention>

Methods

Match(HttpRequestMessage, IHttpRoute, string, IDictionary<string, object>, HttpRouteDirection)

Determines whether this instance equals a specified route.

public virtual bool Match(HttpRequestMessage request, IHttpRoute route, string parameterName, IDictionary<string, object> values, HttpRouteDirection routeDirection)

Parameters

request HttpRequestMessage

The request.

route IHttpRoute

The route to compare.

parameterName string

The name of the parameter.

values IDictionary<string, object>

A list of parameter values.

routeDirection HttpRouteDirection

The route direction.

Returns

bool

True if this instance equals a specified route; otherwise, false.

SelectControllerName(ODataPath, HttpRequestMessage)

Selects the name of the controller to dispatch the request to.

protected virtual string SelectControllerName(ODataPath path, HttpRequestMessage request)

Parameters

path ODataPath

The OData path of the request.

request HttpRequestMessage

The request.

Returns

string

The name of the controller to dispatch to, or null if one cannot be resolved.