3 interfaces inheriting from IParameterPolicy
Microsoft.AspNetCore.Routing (1)
Matching\IParameterLiteralNodeMatchingPolicy.cs (1)
12public interface IParameterLiteralNodeMatchingPolicy : IParameterPolicy
Microsoft.AspNetCore.Routing.Abstractions (2)
IOutboundParameterTransformer.cs (1)
10public interface IOutboundParameterTransformer : IParameterPolicy
IRouteConstraint.cs (1)
17public interface IRouteConstraint : IParameterPolicy
9 implementations of IParameterPolicy
Microsoft.AspNetCore.Routing.Tests (9)
DefaultParameterPolicyFactoryTest.cs (7)
450public class CustomParameterPolicy : IParameterPolicy 454public class CustomParameterPolicyWithArguments : IParameterPolicy 466public class CustomParameterPolicyWithMultipleCtors : IParameterPolicy 483public class CustomParameterPolicyWithMultipleCtorsInAscendingOrder : IParameterPolicy 508public class CustomParameterPolicyWithAmbiguousMultipleCtors : IParameterPolicy 530public class CustomParameterPolicyWithMultipleArguments : IParameterPolicy 546public class CustomParameterPolicyWithOnlyServiceArguments : IParameterPolicy
Matching\DfaMatcherBuilderTest.cs (1)
3465private class CustomParameterPolicy : IParameterPolicy
RouteTest.cs (1)
1867private class TestPolicy : IParameterPolicy
68 references to IParameterPolicy
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointMetadataApiDescriptionProvider.cs (1)
232var policy = _parameterPolicyFactory.Create(parameterPart, parameterPolicyReference);
Microsoft.AspNetCore.Routing (49)
DefaultLinkParser.cs (1)
98var policy = _parameterPolicyFactory.Create(parameter, kvp.Value[i]);
DefaultParameterPolicyFactory.cs (6)
23public override IParameterPolicy Create(RoutePatternParameterPart? parameter, IParameterPolicy parameterPolicy) 35public override IParameterPolicy Create(RoutePatternParameterPart? parameter, string inlineText) 39var parameterPolicy = ParameterPolicyActivator.ResolveParameterPolicy<IParameterPolicy>( 61private static IParameterPolicy InitializeRouteConstraint(
MapRouteRouteBuilderExtensions.cs (1)
161var parameterPolicy = _parameterPolicyFactory.Create(null!, inlineConstraint);
Matching\DfaMatcherBuilder.cs (11)
119private readonly Dictionary<string, IParameterPolicy> _cachedParameters; 124_cachedParameters = new Dictionary<string, IParameterPolicy>(StringComparer.Ordinal); 127public override IParameterPolicy Create(RoutePatternParameterPart parameter, string inlineText) 133if (_cachedParameters.TryGetValue(inlineText, out var parameterPolicy)) 141var createdParameterPolicy = (parameterPolicy is OptionalRouteConstraint optionalRouteConstraint) 155public override IParameterPolicy Create(RoutePatternParameterPart parameter, IParameterPolicy parameterPolicy) 405var parameterPolicy = _parameterPolicyFactory.Create(parameterPart, reference); 436var parameterPolicy = _parameterPolicyFactory.Create(parameterPart, reference); 480var parameterPolicy = _parameterPolicyFactory.Create(parameterPart, reference); 818var parameterPolicy = _parameterPolicyFactory.Create(parameter, reference);
ParameterPolicyActivator.cs (4)
22where T : IParameterPolicy 39if (!typeof(IParameterPolicy).IsAssignableFrom(parameterPolicyType)) 97private static IParameterPolicy CreateParameterPolicy(IServiceProvider? serviceProvider, Type parameterPolicyType, string? argumentString) 143return (IParameterPolicy)activationConstructor.Invoke(parameters);
ParameterPolicyFactory.cs (8)
10/// Defines an abstraction for resolving inline parameter policies as instances of <see cref="IParameterPolicy"/>. 19/// <returns>The <see cref="IParameterPolicy"/> for the parameter.</returns> 20public abstract IParameterPolicy Create(RoutePatternParameterPart? parameter, string inlineText); 27/// <returns>The <see cref="IParameterPolicy"/> for the parameter.</returns> 28public abstract IParameterPolicy Create(RoutePatternParameterPart? parameter, IParameterPolicy parameterPolicy); 35/// <returns>The <see cref="IParameterPolicy"/> for the parameter.</returns> 36public IParameterPolicy Create(RoutePatternParameterPart? parameter, RoutePatternParameterPolicyReference reference)
Patterns\DefaultRoutePatternTransformer.cs (1)
203var policy = _policyFactory.Create(parameter, policies[i]);
Patterns\RoutePatternFactory.cs (4)
659if (kvp.Value is IParameterPolicy parameterPolicy) 673policyReferences.Add(item is IParameterPolicy p ? ParameterPolicy(p) : Constraint(item)); 1002public static RoutePatternParameterPolicyReference ParameterPolicy(IParameterPolicy parameterPolicy) 1145private static RoutePatternParameterPolicyReference ParameterPolicyCore(IParameterPolicy parameterPolicy)
Patterns\RoutePatternParameterPolicyReference.cs (3)
24internal RoutePatternParameterPolicyReference(IParameterPolicy parameterPolicy) 35/// Gets a pre-existing <see cref="IParameterPolicy"/> that was used to construct this reference. 37public IParameterPolicy? ParameterPolicy { get; }
RouteOptions.cs (4)
152public void SetParameterPolicy<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(string token) where T : IParameterPolicy 162/// <exception cref="InvalidOperationException">Throws an exception if the type is not an <see cref="IParameterPolicy"/>.</exception> 165if (!type.IsAssignableTo(typeof(IParameterPolicy))) 167throw new InvalidOperationException($"{type} must implement {typeof(IParameterPolicy)}");
Template\DefaultTemplateBinderFactory.cs (2)
39var policies = new List<(string parameterName, IParameterPolicy policy)>(); 51var parameterPolicy = _policyFactory.Create(parameter, kvp.Value[i]);
Template\TemplateBinder.cs (4)
61/// A list of (<see cref="string"/>, <see cref="IParameterPolicy"/>) pairs to evaluate when producing a URI. 69IEnumerable<(string parameterName, IParameterPolicy policy)>? parameterPolicies) 99IEnumerable<(string parameterName, IParameterPolicy policy)> parameterPolicies) 128IEnumerable<(string parameterName, IParameterPolicy policy)>? parameterPolicies,
Microsoft.AspNetCore.Routing.Tests (18)
DefaultParameterPolicyFactoryTest.cs (17)
48$"The constraint type '{typeof(string)}' which is mapped to constraint key 'bad' must implement the '{nameof(IParameterPolicy)}' interface.", 65var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); 84var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); 104var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); 123var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); 143var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); 156var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "int"); 169var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "range(1,20)"); 184var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id", @default: null, RoutePatternParameterKind.Optional), "int"); 204var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id", @default: null, RoutePatternParameterKind.Optional), "customParameterPolicy"); 223var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "customConstraintPolicy(20)"); 244var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "customConstraintPolicy(20,-1)"); 267var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "customConstraintPolicy"); 288var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "customConstraintPolicy(1)"); 309var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), "customConstraintPolicy(1)"); 352var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id"), @"regex-service(\\d{1,2})"); 393var parameterPolicy = factory.Create(RoutePatternFactory.ParameterPart("id", @default: null, RoutePatternParameterKind.Optional), "customParameterPolicy");
Template\TemplateBinderTests.cs (1)
1305parameterPolicies: new (string, IParameterPolicy)[] { ("param", new LengthRouteConstraint(500)), ("param", new SlugifyParameterTransformer()), });