Class ODataPathRouteConstraint
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
IODataPathHandlerThe OData path handler to use for parsing.
model
IEdmModelThe EDM model to use for parsing the path.
routeName
stringThe 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
RouteName
Gets the name of the route this constraint is associated with.
public string RouteName { get; }
Property Value
RoutingConventions
Gets the OData routing conventions to use for selecting the controller name.
public IEnumerable<IODataRoutingConvention> RoutingConventions { get; }
Property Value
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
HttpRequestMessageThe request.
route
IHttpRouteThe route to compare.
parameterName
stringThe name of the parameter.
values
IDictionary<string, object>A list of parameter values.
routeDirection
HttpRouteDirectionThe 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
ODataPathThe OData path of the request.
request
HttpRequestMessageThe request.
Returns
- string
The name of the controller to dispatch to, or null if one cannot be resolved.