Dela via


Microsoft.AspNetCore.Routing.Constraints Namespace

Provides types that are used to apply route constraints. Route constraints generally inspect the route value associated via the route template and make a true or false decision about whether the value is acceptable. Custom route constraints can be created by implementing IRouteConstraint and registering them with the app's ConstraintMap.

Classes

AlphaRouteConstraint

Constrains a route parameter to contain only lowercase or uppercase letters A through Z in the English alphabet.

BoolRouteConstraint

Constrains a route parameter to represent only Boolean values.

CompositeRouteConstraint

Constrains a route by several child constraints.

DateTimeRouteConstraint

Constrains a route parameter to represent only DateTime values.

DecimalRouteConstraint

Constrains a route parameter to represent only decimal values.

DoubleRouteConstraint

Constrains a route parameter to represent only 64-bit floating-point values.

FileNameRouteConstraint

Constrains a route parameter to represent only file name values. Does not validate that the route value contains valid file system characters, or that the value represents an actual file on disk.

FloatRouteConstraint

Constrains a route parameter to represent only 32-bit floating-point values.

GuidRouteConstraint

Constrains a route parameter to represent only Guid values. Matches values specified in any of the five formats "N", "D", "B", "P", or "X", supported by Guid.ToString(string) and Guid.ToString(String, IFormatProvider) methods.

HttpMethodRouteConstraint

Constrains the HTTP method of request or a route.

IntRouteConstraint

Constrains a route parameter to represent only 32-bit integer values.

LengthRouteConstraint

Constrains a route parameter to be a string of a given length or within a given range of lengths.

LongRouteConstraint

Constrains a route parameter to represent only 64-bit integer values.

MaxLengthRouteConstraint

Constrains a route parameter to be a string with a maximum length.

MaxRouteConstraint

Constrains a route parameter to be an integer with a maximum value.

MinLengthRouteConstraint

Constrains a route parameter to be a string with a minimum length.

MinRouteConstraint

Constrains a route parameter to be a long with a minimum value.

NonFileNameRouteConstraint

Constrains a route parameter to represent only non-file-name values. Does not validate that the route value contains valid file system characters, or that the value represents an actual file on disk.

OptionalRouteConstraint

Defines a constraint on an optional parameter. If the parameter is present, then it is constrained by InnerConstraint.

RangeRouteConstraint

Constraints a route parameter to be an integer within a given range of values.

RegexInlineRouteConstraint

Represents a regex constraint which can be used as an inlineConstraint.

RegexRouteConstraint

Constrains a route parameter to match a regular expression.

RequiredRouteConstraint

Constraints a route parameter that must have a value.

StringRouteConstraint

Constrains a route parameter to contain only a specified string.

Remarks

For more information about routing constraints, see Route constraint reference.