37 implementations of IRouteConstraint
Microsoft.AspNetCore.Mvc.Core (1)
Routing\KnownRouteValueConstraint.cs (1)
17
public class KnownRouteValueConstraint :
IRouteConstraint
Microsoft.AspNetCore.Routing (24)
Constraints\BoolRouteConstraint.cs (1)
18
public class BoolRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\CompositeRouteConstraint.cs (1)
16
public class CompositeRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy
Constraints\DateTimeRouteConstraint.cs (1)
24
public class DateTimeRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\DecimalRouteConstraint.cs (1)
18
public class DecimalRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\DoubleRouteConstraint.cs (1)
18
public class DoubleRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\FileNameRouteConstraint.cs (1)
89
public class FileNameRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\FloatRouteConstraint.cs (1)
18
public class FloatRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\GuidRouteConstraint.cs (1)
20
public class GuidRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\HttpMethodRouteConstraint.cs (1)
13
public class HttpMethodRouteConstraint :
IRouteConstraint
Constraints\IntRouteConstraint.cs (1)
18
public class IntRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\LengthRouteConstraint.cs (1)
17
public class LengthRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\LongRouteConstraint.cs (1)
18
public class LongRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\MaxLengthRouteConstraint.cs (1)
18
public class MaxLengthRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\MaxRouteConstraint.cs (1)
18
public class MaxRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\MinLengthRouteConstraint.cs (1)
18
public class MinLengthRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\MinRouteConstraint.cs (1)
18
public class MinRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\NonFileNameRouteConstraint.cs (1)
85
public class NonFileNameRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\NullRouteConstraint.cs (1)
12
internal sealed class NullRouteConstraint :
IRouteConstraint
Constraints\OptionalRouteConstraint.cs (1)
16
public class OptionalRouteConstraint :
IRouteConstraint
Constraints\RangeRouteConstraint.cs (1)
18
public class RangeRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Constraints\RegexErrorStubRouteConstraint.cs (1)
13
internal sealed class RegexErrorStubRouteConstraint :
IRouteConstraint
Constraints\RegexRouteConstraint.cs (1)
21
public class RegexRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy
Constraints\RequiredRouteConstraint.cs (1)
16
public class RequiredRouteConstraint :
IRouteConstraint
Constraints\StringRouteConstraint.cs (1)
13
public class StringRouteConstraint :
IRouteConstraint
, IParameterLiteralNodeMatchingPolicy, ICachableParameterPolicy
Microsoft.AspNetCore.Routing.Tests (10)
ConstraintMatcherTest.cs (2)
212
private class PassConstraint :
IRouteConstraint
237
private class FailConstraint :
IRouteConstraint
DefaultInlineConstraintResolverTest.cs (2)
374
private class MultiConstructorRouteConstraint :
IRouteConstraint
394
private class CustomRouteConstraint :
IRouteConstraint
DefaultLinkGeneratorTest.cs (1)
552
private class TestRouteConstraint :
IRouteConstraint
DefaultParameterPolicyFactoryTest.cs (1)
418
private class TestRouteConstraint :
IRouteConstraint
InlineRouteParameterParserTests.cs (1)
969
private class TestRouteConstraint :
IRouteConstraint
RouteOptionsTests.cs (1)
59
private class TestRouteConstraint :
IRouteConstraint
RoutingServiceCollectionExtensionsTests.cs (1)
54
public class DummyRegexRouteConstraint :
IRouteConstraint
TestObjects\CapturingConstraint.cs (1)
8
internal class CapturingConstraint :
IRouteConstraint
Mvc.RoutingWebSite (1)
QueryStringConstraint.cs (1)
6
public class QueryStringConstraint :
IRouteConstraint
RoutingWebSite (1)
EndsWithStringRouteConstraint.cs (1)
8
internal class EndsWithStringRouteConstraint :
IRouteConstraint
136 references to IRouteConstraint
Microsoft.AspNetCore.Mvc.Abstractions (2)
ApiExplorer\ApiParameterRouteInfo.cs (2)
14
/// Gets or sets the set of <see cref="
IRouteConstraint
"/> objects for the parameter.
20
public IEnumerable<
IRouteConstraint
>? Constraints { get; set; }
Microsoft.AspNetCore.Mvc.ApiExplorer (3)
DefaultApiDescriptionProvider.cs (1)
346
var constraints = new List<
IRouteConstraint
>();
EndpointMetadataApiDescriptionProvider.cs (2)
226
var constraints = new List<
IRouteConstraint
>();
233
if (policy is
IRouteConstraint
generatedConstraint)
Microsoft.AspNetCore.Mvc.Core (1)
Routing\KnownRouteValueConstraint.cs (1)
15
/// A <see cref="
IRouteConstraint
"/> that represents a known route value.
Microsoft.AspNetCore.Mvc.Core.Test (1)
Routing\KnownRouteValueConstraintTests.cs (1)
39
var
constraint = inlineConstraintResolver.ResolveConstraint("exists");
Microsoft.AspNetCore.OpenApi (3)
Extensions\JsonNodeSchemaExtensions.cs (3)
194
/// <param name="constraints">The list of <see cref="
IRouteConstraint
"/>s associated with the route parameter.</param>
195
internal static void ApplyRouteConstraints(this JsonNode schema, IEnumerable<
IRouteConstraint
> constraints)
199
foreach (
var
constraint in Enumerable.Reverse(constraints))
Microsoft.AspNetCore.Routing (75)
Constraints\CompositeRouteConstraint.cs (4)
25
public CompositeRouteConstraint(IEnumerable<
IRouteConstraint
> constraints)
35
public IEnumerable<
IRouteConstraint
> Constraints { get; private set; }
53
foreach (
var
constraint in Constraints)
71
foreach (
var
constraint in Constraints)
Constraints\OptionalRouteConstraint.cs (3)
25
public OptionalRouteConstraint(
IRouteConstraint
innerConstraint)
33
/// Gets the <see cref="
IRouteConstraint
"/> associated with the optional parameter.
35
public
IRouteConstraint
InnerConstraint { get; }
Constraints\RegexErrorStubRouteConstraint.cs (1)
24
bool
IRouteConstraint
.Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
DefaultInlineConstraintResolver.cs (2)
48
public virtual
IRouteConstraint
? ResolveConstraint(string inlineConstraint)
53
return ParameterPolicyActivator.ResolveParameterPolicy<
IRouteConstraint
>(
DefaultLinkGenerator.cs (3)
299
if (!templateBinder.TryProcessConstraints(httpContext, templateValuesResult.CombinedValues, out var parameterName, out
var
constraint))
379
public static void TemplateFailedConstraint(ILogger logger, RouteEndpoint endpoint, string? parameterName,
IRouteConstraint
? constraint, RouteValueDictionary values)
393
private static partial void TemplateFailedConstraint(ILogger logger, string? template, string? endpoint,
IRouteConstraint
? constraint, string? parameterName, string values);
DefaultLinkParser.cs (7)
89
var constraints = new Dictionary<string, List<
IRouteConstraint
>>(StringComparer.OrdinalIgnoreCase);
94
var constraintsForParameter = new List<
IRouteConstraint
>();
99
if (policy is
IRouteConstraint
constraint)
134
var
constraint = kvp.Value[i];
155
public readonly Dictionary<string, List<
IRouteConstraint
>> Constraints;
157
public MatcherState(RoutePatternMatcher matcher, Dictionary<string, List<
IRouteConstraint
>> constraints)
163
public void Deconstruct(out RoutePatternMatcher matcher, out Dictionary<string, List<
IRouteConstraint
>> constraints)
DefaultParameterPolicyFactory.cs (3)
27
if (parameterPolicy is
IRouteConstraint
routeConstraint)
53
if (parameterPolicy is
IRouteConstraint
constraint)
63
IRouteConstraint
routeConstraint)
IInlineConstraintResolver.cs (3)
8
/// Defines an abstraction for resolving inline constraints as instances of <see cref="
IRouteConstraint
"/>.
19
/// <returns>The <see cref="
IRouteConstraint
"/> the inline constraint was resolved to.</returns>
20
IRouteConstraint
? ResolveConstraint(string inlineConstraint);
MapRouteRouteBuilderExtensions.cs (2)
153
public
IRouteConstraint
? ResolveConstraint(string inlineConstraint)
155
var
routeConstraint = _inner.ResolveConstraint(inlineConstraint);
Matching\Candidate.cs (3)
34
public readonly KeyValuePair<string,
IRouteConstraint
>[] Constraints;
58
Constraints = Array.Empty<KeyValuePair<string,
IRouteConstraint
>>();
71
KeyValuePair<string,
IRouteConstraint
>[] constraints)
Matching\DfaMatcher.cs (2)
299
KeyValuePair<string,
IRouteConstraint
>[] constraints,
380
public static void CandidateRejectedByConstraint(ILogger logger, string path, Endpoint endpoint, string constraintName,
IRouteConstraint
constraint, object? value)
Matching\DfaMatcherBuilder.cs (5)
32
private readonly List<KeyValuePair<string,
IRouteConstraint
>> _constraints;
56
_constraints = new List<KeyValuePair<string,
IRouteConstraint
>>();
819
if (parameterPolicy is
IRouteConstraint
routeConstraint)
821
_constraints.Add(new KeyValuePair<string,
IRouteConstraint
>(kvp.Key, routeConstraint));
844
Array.Empty<KeyValuePair<string,
IRouteConstraint
>>());
Patterns\DefaultRoutePatternTransformer.cs (1)
204
if (policy is
IRouteConstraint
constraint)
Patterns\RoutePatternFactory.cs (5)
680
typeof(
IRouteConstraint
)));
941
/// The constraint object, which must be of type <see cref="
IRouteConstraint
"/>
949
if (constraint is
IRouteConstraint
policy)
961
typeof(
IRouteConstraint
)));
972
public static RoutePatternParameterPolicyReference Constraint(
IRouteConstraint
constraint)
Patterns\RoutePatternTransformer.cs (2)
30
/// The substitution process considers default values and <see cref="
IRouteConstraint
"/> implementations
56
/// The substitution process considers default values and <see cref="
IRouteConstraint
"/> implementations
RouteBase.cs (2)
67
public virtual IDictionary<string,
IRouteConstraint
> Constraints { get; protected set; }
204
protected static IDictionary<string,
IRouteConstraint
> GetConstraints(
RouteConstraintBuilder.cs (14)
13
/// A builder for produding a mapping of keys to see <see cref="
IRouteConstraint
"/>.
27
private readonly Dictionary<string, List<
IRouteConstraint
>> _constraints;
44
_constraints = new Dictionary<string, List<
IRouteConstraint
>>(StringComparer.OrdinalIgnoreCase);
52
public IDictionary<string,
IRouteConstraint
> Build()
54
var constraints = new Dictionary<string,
IRouteConstraint
>(StringComparer.OrdinalIgnoreCase);
57
IRouteConstraint
constraint;
87
/// The constraint instance. Must either be a string or an instance of <see cref="
IRouteConstraint
"/>.
100
var
constraint = value as
IRouteConstraint
;
111
typeof(
IRouteConstraint
)));
128
/// The <see cref="IInlineConstraintResolver"/> can create <see cref="
IRouteConstraint
"/> instances
137
var
constraint = _inlineConstraintResolver.ResolveConstraint(constraintText);
167
private void Add(string key,
IRouteConstraint
constraint)
171
list = new List<
IRouteConstraint
>();
RouteConstraintMatcher.cs (3)
37
IDictionary<string,
IRouteConstraint
> constraints,
63
var
constraint = kvp.Value;
96
IRouteConstraint
routeConstraint);
RouteOptions.cs (1)
173
private static void AddConstraint<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TConstraint>(Dictionary<string, Type> constraintMap, string text) where TConstraint :
IRouteConstraint
Template\DefaultTemplateBinderFactory.cs (1)
58
if (parameterPolicy is
IRouteConstraint
constraint)
Template\TemplateBinder.cs (6)
24
private readonly (string parameterName,
IRouteConstraint
constraint)[] _constraints;
129
out (string parameterName,
IRouteConstraint
constraint)[] constraints,
132
List<(string parameterName,
IRouteConstraint
constraint)>? constraintList = null;
139
if (p.policy is
IRouteConstraint
routeConstraint)
150
constraints = constraintList?.ToArray() ?? Array.Empty<(string,
IRouteConstraint
)>();
431
public bool TryProcessConstraints(HttpContext? httpContext, RouteValueDictionary combinedValues, out string? parameterName, out
IRouteConstraint
? constraint)
Tree\InboundRouteEntry.cs (1)
30
public IDictionary<string,
IRouteConstraint
> Constraints { get; set; }
Tree\OutboundRouteEntry.cs (1)
19
public IDictionary<string,
IRouteConstraint
> Constraints { get; set; }
Microsoft.AspNetCore.Routing.Tests (50)
ConstraintMatcherTest.cs (9)
23
var constraints = new Dictionary<string,
IRouteConstraint
>
50
var constraints = new Dictionary<string,
IRouteConstraint
>
69
var constraints = new Dictionary<string,
IRouteConstraint
>
84
var constraints = new Dictionary<string,
IRouteConstraint
>
104
var constraints = new Dictionary<string,
IRouteConstraint
>
124
var constraints = new Dictionary<string,
IRouteConstraint
>
144
var constraints = new Dictionary<string,
IRouteConstraint
>
164
var constraints = new Dictionary<string,
IRouteConstraint
>
193
private TestSink SetUpMatch(Dictionary<string,
IRouteConstraint
> constraints, bool loggerEnabled)
Constraints\CompositeRouteConstraintTests.cs (3)
35
static readonly Expression<Func<
IRouteConstraint
, bool>> ConstraintMatchMethodExpression =
43
private static Mock<
IRouteConstraint
> MockConstraintWithResult(bool result)
45
var mock = new Mock<
IRouteConstraint
>();
Constraints\ConstraintsTestHelper.cs (1)
8
public static bool TestConstraint(
IRouteConstraint
constraint, object value)
DefaultInlineConstraintResolverTest.cs (23)
28
var
constraint = _constraintResolver.ResolveConstraint("required");
38
var
constraint = _constraintResolver.ResolveConstraint("int");
60
var
constraint = _constraintResolver.ResolveConstraint("alpha");
70
var
constraint = _constraintResolver.ResolveConstraint("regex(ab,1)");
80
var
constraint = _constraintResolver.ResolveConstraint(
91
var
constraint = _constraintResolver.ResolveConstraint("bool");
108
var
constraint = _constraintResolver.ResolveConstraint("datetime");
118
var
constraint = _constraintResolver.ResolveConstraint("decimal");
128
var
constraint = _constraintResolver.ResolveConstraint("double");
138
var
constraint = _constraintResolver.ResolveConstraint("float");
148
var
constraint = _constraintResolver.ResolveConstraint("guid");
158
var
constraint = _constraintResolver.ResolveConstraint("int");
168
var
constraint = _constraintResolver.ResolveConstraint("length(5)");
180
var
constraint = _constraintResolver.ResolveConstraint("length(5, 10)");
192
var
constraint = _constraintResolver.ResolveConstraint("long");
202
var
constraint = _constraintResolver.ResolveConstraint("max(10)");
213
var
constraint = _constraintResolver.ResolveConstraint("maxlength(10)");
224
var
constraint = _constraintResolver.ResolveConstraint("min(3)");
235
var
constraint = _constraintResolver.ResolveConstraint("minlength(3)");
246
var
constraint = _constraintResolver.ResolveConstraint("range(5, 10)");
264
var
constraint = resolver.ResolveConstraint("custom(argument)");
279
var
constraint = resolver.ResolveConstraint("custom(argument)");
304
var
constraint = resolver.ResolveConstraint("custom(argument)");
DefaultLinkGeneratorProcessTemplateTest.cs (1)
748
var target = new Mock<
IRouteConstraint
>();
Patterns\RoutePatternFactoryTest.cs (3)
321
var constraints = new { d = Mock.Of<
IRouteConstraint
>(), e = Mock.Of<
IRouteConstraint
>(), };
398
$"Invalid constraint '17'. A constraint must be of type 'string' or '{typeof(
IRouteConstraint
)}'.",
RouteConstraintBuilderTest.cs (4)
36
var
originalConstraint = Mock.Of<
IRouteConstraint
>();
83
typeof(
IRouteConstraint
) + "'.");
166
var
constraint = Assert.Single(builder.Build()).Value;
RouteTest.cs (6)
321
var
innerConstraint = ((OptionalRouteConstraint)route.Constraints["id"]).InnerConstraint;
324
Assert.Equal(2, compositeConstraint.Constraints.Count<
IRouteConstraint
>());
955
var target = new Mock<
IRouteConstraint
>();
1621
typeof(
IRouteConstraint
) + "'.";
1632
var
mockConstraint = new Mock<
IRouteConstraint
>().Object;
Microsoft.AspNetCore.StaticAssets (1)
Development\StaticAssetDevelopmentRuntimeHandler.cs (1)
308
private sealed class FileExistsConstraint(IWebHostEnvironment environment) :
IRouteConstraint