Class OptionalRouteConstraint
- Namespace
- System.Web.Http.Routing.Constraints
- Assembly
- System.Web.Http.dll
Constrains a route by an inner constraint that doesn't fail when an optional parameter is set to its default value.
public class OptionalRouteConstraint : IHttpRouteConstraint
- Inheritance
-
OptionalRouteConstraint
- Implements
- Inherited Members
Constructors
OptionalRouteConstraint(IHttpRouteConstraint)
Initializes a new instance of the OptionalRouteConstraint class.
public OptionalRouteConstraint(IHttpRouteConstraint innerConstraint)
Parameters
innerConstraint
IHttpRouteConstraintThe inner constraint to match if the parameter is not an optional parameter without a value
Properties
InnerConstraint
Gets the inner constraint to match if the parameter is not an optional parameter without a value.
public IHttpRouteConstraint InnerConstraint { get; }
Property Value
- IHttpRouteConstraint
The inner constraint to match if the parameter is not an optional parameter without a value.
Methods
Match(HttpRequestMessage, IHttpRoute, string, IDictionary<string, object>, HttpRouteDirection)
Determines whether this instance equals a specified route.
public 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.