Table of Contents

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 IHttpRouteConstraint

The 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 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.