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