3 instantiations of RoutePatternParameterPart
Microsoft.AspNetCore.Routing (3)
Patterns\RouteParameterParser.cs (2)
22
return new
RoutePatternParameterPart
(string.Empty, null, RoutePatternParameterKind.Standard, Array.Empty<RoutePatternParameterPolicyReference>());
87
return new
RoutePatternParameterPart
(
Patterns\RoutePatternFactory.cs (1)
929
return new
RoutePatternParameterPart
(
215 references to RoutePatternParameterPart
Microsoft.AspNetCore.App.Analyzers.Test (2)
RouteEmbeddedLanguage\RoutePatternParserTests.cs (2)
152
IReadOnlyList<
RoutePatternParameterPart
> parsedRoutePatterns = null;
203
foreach (
var
parsedRoutePattern in parsedRoutePatterns)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointMetadataApiDescriptionProvider.cs (1)
221
if (pattern.GetParameter(parameter.Name) is not
RoutePatternParameterPart
parameterPart)
Microsoft.AspNetCore.Mvc.Core (2)
Routing\ActionEndpointFactory.cs (1)
283
var
parameter = attributeRoutePattern.GetParameter(routeValue.Key);
Routing\RoutePatternWriter.cs (1)
34
if (part.IsParameter && part is
RoutePatternParameterPart
parameterPart)
Microsoft.AspNetCore.OpenApi (1)
Extensions\ApiDescriptionExtensions.cs (1)
62
else if (part is
RoutePatternParameterPart
parameterPart)
Microsoft.AspNetCore.Routing (87)
DefaultLinkParser.cs (1)
95
var
parameter = endpoint.RoutePattern.GetParameter(kvp.Key);
DefaultParameterPolicyFactory.cs (2)
23
public override IParameterPolicy Create(
RoutePatternParameterPart
? parameter, IParameterPolicy parameterPolicy)
35
public override IParameterPolicy Create(
RoutePatternParameterPart
? parameter, string inlineText)
Matching\DfaMatcherBuilder.cs (15)
127
public override IParameterPolicy Create(
RoutePatternParameterPart
parameter, string inlineText)
155
public override IParameterPolicy Create(
RoutePatternParameterPart
parameter, IParameterPolicy parameterPolicy)
261
var
parameterPart = part as
RoutePatternParameterPart
;
372
private void AddParentsMatchingComplexSegment(RouteEndpoint endpoint, List<DfaNode> nextParents, RoutePatternPathSegment segment, DfaNode parent,
RoutePatternParameterPart
parameterPart)
386
if (segmentPart is not
RoutePatternParameterPart
partParameter)
425
private void AddParentsWithMatchingLiteralConstraints(List<DfaNode> nextParents, DfaNode parent,
RoutePatternParameterPart
parameterPart, IReadOnlyList<RoutePatternParameterPolicyReference> parameterPolicyReferences)
473
private void AddRequiredLiteralValue(RouteEndpoint endpoint, List<DfaNode> nextParents, DfaNode parent,
RoutePatternParameterPart
parameterPart, object requiredValue)
524
if (lastSegment.IsSimple && lastSegment.Parts[0] is
RoutePatternParameterPart
parameterPart && parameterPart.IsCatchAll)
761
var
parameterPart = segment.Parts[0] as
RoutePatternParameterPart
;
813
var
parameter = routeEndpoint.RoutePattern.GetParameter(kvp.Key); // may be null, that's ok
859
var
parameterPart = segment.Parts[0] as
RoutePatternParameterPart
;
980
private static bool TryGetRequiredValue(RoutePattern routePattern,
RoutePatternParameterPart
parameterPart, out object value)
ParameterPolicyFactory.cs (3)
20
public abstract IParameterPolicy Create(
RoutePatternParameterPart
? parameter, string inlineText);
28
public abstract IParameterPolicy Create(
RoutePatternParameterPart
? parameter, IParameterPolicy parameterPolicy);
36
public IParameterPolicy Create(
RoutePatternParameterPart
? parameter, RoutePatternParameterPolicyReference reference)
Patterns\DefaultRoutePatternTransformer.cs (8)
50
RoutePatternParameterPart
parameter;
150
List<
RoutePatternParameterPart
> updatedParameters = null;
159
var
parameter = original.GetParameter(kvp.Key);
175
updatedParameters = new List<
RoutePatternParameterPart
>(original.Parameters);
197
private bool MatchesConstraints(RoutePattern pattern,
RoutePatternParameterPart
parameter, string key, RouteValueDictionary requiredValues)
217
private static void RemoveParameterDefault(List<RoutePatternPathSegment> segments, List<
RoutePatternParameterPart
> parameters,
RoutePatternParameterPart
parameter)
228
var
updatedParameter = RoutePatternFactory.ParameterPart(parameter.Name, @default: null, parameter.ParameterKind, parameter.ParameterPolicies);
Patterns\RouteParameterParser.cs (1)
16
public static
RoutePatternParameterPart
ParseRouteParameter(string parameter)
Patterns\RoutePattern.cs (4)
45
IReadOnlyList<
RoutePatternParameterPart
> parameters,
126
public IReadOnlyList<
RoutePatternParameterPart
> Parameters { get; }
138
public
RoutePatternParameterPart
? GetParameter(string name)
147
var
parameter = parameters[i];
Patterns\RoutePatternFactory.cs (25)
469
List<
RoutePatternParameterPart
>? parameters = null;
478
if (segment.Parts[j] is
RoutePatternParameterPart
parameter)
482
parameters = new List<
RoutePatternParameterPart
>();
540
(IReadOnlyList<
RoutePatternParameterPart
>?)parameters ?? Array.Empty<
RoutePatternParameterPart
>(),
578
var
parameter = (
RoutePatternParameterPart
)part;
765
/// Creates a <see cref="
RoutePatternParameterPart
"/> from the provided parameter name.
768
/// <returns>The <see cref="
RoutePatternParameterPart
"/>.</returns>
769
public static
RoutePatternParameterPart
ParameterPart(string parameterName)
786
/// Creates a <see cref="
RoutePatternParameterPart
"/> from the provided parameter name
791
/// <returns>The <see cref="
RoutePatternParameterPart
"/>.</returns>
792
public static
RoutePatternParameterPart
ParameterPart(string parameterName, object @default)
809
/// Creates a <see cref="
RoutePatternParameterPart
"/> from the provided parameter name
815
/// <returns>The <see cref="
RoutePatternParameterPart
"/>.</returns>
816
public static
RoutePatternParameterPart
ParameterPart(
841
/// Creates a <see cref="
RoutePatternParameterPart
"/> from the provided parameter name
848
/// <returns>The <see cref="
RoutePatternParameterPart
"/>.</returns>
849
public static
RoutePatternParameterPart
ParameterPart(
877
/// Creates a <see cref="
RoutePatternParameterPart
"/> from the provided parameter name
884
/// <returns>The <see cref="
RoutePatternParameterPart
"/>.</returns>
885
public static
RoutePatternParameterPart
ParameterPart(
912
private static
RoutePatternParameterPart
ParameterPartCore(
922
private static
RoutePatternParameterPart
ParameterPartCore(
1071
static Action<
RoutePatternParameterPart
> CheckDuplicateParameters(int parameterCount, string rawText)
Patterns\RoutePatternMatcher.cs (13)
50
var
parameter = (
RoutePatternParameterPart
)part;
93
else if (pathSegment.IsSimple && pathSegment.Parts[0] is
RoutePatternParameterPart
parameter && parameter.IsCatchAll)
127
var
parameter = (
RoutePatternParameterPart
)part;
175
if (part is
RoutePatternParameterPart
parameter && (parameter.IsCatchAll || _hasDefaultValue[i]))
229
var
part = (
RoutePatternParameterPart
)pathSegment.Parts[0];
249
if (pathSegment.IsSimple && pathSegment.Parts[0] is
RoutePatternParameterPart
parameter && parameter.IsCatchAll)
270
parameter = (
RoutePatternParameterPart
)pathSegment.Parts[0];
302
if (routeSegment.Parts[indexOfLastSegment] is
RoutePatternParameterPart
parameter && parameter.IsOptional &&
344
RoutePatternParameterPart
parameterNeedsValue = null; // Keeps track of a parameter segment that is pending a value
357
parameterNeedsValue = (
RoutePatternParameterPart
)part;
Patterns\RoutePatternParameterKind.cs (1)
8
/// Defines the kinds of <see cref="
RoutePatternParameterPart
"/> instances.
Patterns\RoutePatternParameterPart.cs (1)
10
/// Represents a parameter part in a route pattern. Instances of <see cref="
RoutePatternParameterPart
"/>
Patterns\RoutePatternParser.cs (4)
214
var
templatePart = RouteParameterParser.ParseRouteParameter(decoded);
325
if (part is
RoutePatternParameterPart
parameter
344
if (part is
RoutePatternParameterPart
parameter && parameter.IsCatchAll && parts.Count > 1)
357
if (part is
RoutePatternParameterPart
parameter && parameter.IsOptional && parts.Count > 1)
Patterns\RoutePatternPartKind.cs (1)
21
/// The <see cref="RoutePatternPartKind"/> of a <see cref="
RoutePatternParameterPart
"/>.
RouteEndpointDataSource.cs (1)
285
foreach (
var
routePatternPart in pattern.Parameters)
Template\DefaultTemplateBinderFactory.cs (1)
45
var
parameter = pattern.GetParameter(parameterName);
Template\RoutePrecedence.cs (2)
189
else if (part is
RoutePatternParameterPart
parameterPart)
263
else if (part is
RoutePatternParameterPart
parameterPart)
Template\TemplateBinder.cs (3)
268
var
parameter = parameters[i];
541
else if (part is
RoutePatternParameterPart
parameterPart)
711
var
parameter = _pattern.GetParameter(kvp.Key);
Template\TemplatePart.cs (1)
37
else if (other.IsParameter && other is
RoutePatternParameterPart
parameter)
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
src\Http\Routing\test\UnitTests\Matching\RouteMatcherBuilder.cs (1)
55
var
parameter = withoutDefaults.Parameters[i];
src\Http\Routing\test\UnitTests\Matching\TreeRouterMatcherBuilder.cs (1)
59
var
parameter = endpoint.RoutePattern.Parameters[i];
Microsoft.AspNetCore.Routing.Tests (120)
DefaultParameterPolicyFactoryTest.cs (5)
58
var
parameter = RoutePatternFactory.ParameterPart(
77
var
parameter = RoutePatternFactory.ParameterPart(
97
var
parameter = RoutePatternFactory.ParameterPart(
116
var
parameter = RoutePatternFactory.ParameterPart(
136
var
parameter = RoutePatternFactory.ParameterPart(
Matching\RouteMatcherBuilder.cs (1)
55
var
parameter = withoutDefaults.Parameters[i];
Matching\TreeRouterMatcherBuilder.cs (1)
59
var
parameter = endpoint.RoutePattern.Parameters[i];
Patterns\InlineRouteParameterParserTest.cs (77)
14
var
templatePart = ParseParameter(parameterName);
26
var
templatePart = ParseParameter("param=");
38
var
templatePart = ParseParameter("param:");
50
var
templatePart = ParseParameter("param:=");
62
var
templatePart = ParseParameter("param=:");
74
var
templatePart = ParseParameter("param:int=111111");
88
var
templatePart = ParseParameter(@"param:test(\d+)=111111");
102
var
templatePart = ParseParameter(@"param:int?");
116
var
templatePart = ParseParameter(@"param:int=12?");
131
var
templatePart = ParseParameter(@"param:int=12??");
146
var
templatePart = ParseParameter(@"param:test(\d+)?");
160
var
templatePart = ParseParameter(@"param:test(\d+)=abc?");
176
var
templatePart = ParseParameter(@"param:test(d+):test(w+)");
190
var
templatePart = ParseParameter(@"param::test(d+)::test(w+)");
205
var
templatePart = ParseParameter(@"param:test(\d+):test(\w:+)");
219
var
templatePart = ParseParameter(@"param:test(\d+):test(\w+)=qwer");
235
var
templatePart = ParseParameter(@"param:test(\d+)::test(\w+)==qwer");
255
var
templatePart = ParseParameter($"comparison-operator:length(6)={defaultValue}");
274
var
param1 = parameters[0];
284
var
param2 = parameters[1];
289
var
param3 = parameters[2];
298
var
templatePart = ParseParameter("world");
308
var
templatePart = ParseParameter("param=world");
319
var
templatePart = ParseParameter(@"param:test(\})");
332
var
templatePart = ParseParameter(@"param:test(\})=wer");
347
var
templatePart = ParseParameter(@"param:test(\))");
360
var
templatePart = ParseParameter(@"param:test(\))=fsd");
375
var
templatePart = ParseParameter(@"param:test(:)");
388
var
templatePart = ParseParameter(@"param:test(:)=mnf");
403
var
templatePart = ParseParameter(@"param:test(a:b:c)");
416
var
templatePart = ParseParameter(@":param:test=12");
431
var
templatePart = ParseParameter(@":param::test=12");
447
var
templatePart = ParseParameter(@":param:test:");
461
var
templatePart = ParseParameter(@"param:test(\w,\w)");
474
var
templatePart = ParseParameter(@"par,am:test(\w)");
487
var
templatePart = ParseParameter(@"param:test(\w,\w)=jsd");
502
var
templatePart = ParseParameter(@"param:int=?");
518
var
templatePart = ParseParameter(@"param:test(=)");
532
var
templatePart = ParseParameter(@"param=test=bar");
543
var
templatePart = ParseParameter(@"param:test(a==b)");
557
var
templatePart = ParseParameter(@"param:test(a==b)=dvds");
571
var
templatePart = ParseParameter(@"par==am:test=dvds");
582
var
templatePart = ParseParameter(@"param:test==dvds");
593
var
templatePart = ParseParameter(@"par=am:test(asd)");
604
var
templatePart = ParseParameter(@"par=test(am):est=asd");
615
var
templatePart = ParseParameter(@"param:test(=)=sds");
629
var
templatePart = ParseParameter(@"param:test(\{)");
642
var
templatePart = ParseParameter(@"par{am:test(\sd)");
655
var
templatePart = ParseParameter(@"param:test(\{)=xvc");
670
var
templatePart = ParseParameter(@"par(am:test(\()");
683
var
templatePart = ParseParameter(@"param:test(\()");
696
var
templatePart = ParseParameter(@"param:test(#$%");
709
var
templatePart = ParseParameter(@"param:test(#:test1");
723
var
templatePart = ParseParameter(@"param:test(abc:somevalue):name(test1:differentname=default-value");
739
var
templatePart = ParseParameter(@"param:test(constraintvalue=test1");
753
var
templatePart = ParseParameter(@"param:test(\()=djk");
768
var
templatePart = ParseParameter(@"param:test(\?)");
783
var
templatePart = ParseParameter(@"param:test(\?)?");
798
var
templatePart = ParseParameter(@"param:test(\?)=sdf");
813
var
templatePart = ParseParameter(@"param:test(\?)=sdf?");
828
var
templatePart = ParseParameter(@"par?am:test(\?)");
843
var
templatePart = ParseParameter(@"param:test(#):$)");
859
var
templatePart = ParseParameter(@"param:test(#:)$)");
874
var
templatePart = ParseParameter(@"foo:regex(\\(\\(\\(\\()");
889
var
templatePart = ParseParameter(@"p1:regex(^\d{{3}}-\d{{3}}-\d{{4}}$)"); // ssn
904
var
templatePart = ParseParameter(@"p1:regex(^\d{{3}}-\d{{3}}-\d{{4}}$)=123-456-7890"); // ssn
929
var
templatePart = ParseParameter(parameter);
941
var
parameterPart = ParseParameter("*path");
954
var
parameterPart = ParseParameter("*path=a/b/c");
972
var
parameterPart = ParseParameter($"*path:{constraintContent}");
990
var
parameterPart = ParseParameter($"*path:{constraintContent}=a/b/c");
1007
var
parameterPart = ParseParameter("**path");
1019
var
parameterPart = ParseParameter("**path=a/b/c");
1036
var
parameterPart = ParseParameter($"**path:{constraintContent}");
1053
var
parameterPart = ParseParameter($"**path:{constraintContent}=a/b/c");
1065
private
RoutePatternParameterPart
ParseParameter(string routeParameter)
1068
var
templatePart = RouteParameterParser.ParseRouteParameter(routeParameter);
Patterns\RoutePatternFactoryTest.cs (25)
407
var
paramPartB = RoutePatternFactory.ParameterPart("B");
408
var
paramPartC = RoutePatternFactory.ParameterPart("C");
409
var
paramPartD = RoutePatternFactory.ParameterPart("D");
436
var
paramPartB = RoutePatternFactory.ParameterPart("B");
437
var
paramPartC = RoutePatternFactory.ParameterPart("C");
438
var
paramPartD = RoutePatternFactory.ParameterPart("D");
466
var
paramPartB = RoutePatternFactory.ParameterPart("B");
467
var
paramPartC = RoutePatternFactory.ParameterPart("C");
468
var
paramPartD = RoutePatternFactory.ParameterPart("D");
506
var
paramPartB = RoutePatternFactory.ParameterPart("B");
507
var
paramPartC = RoutePatternFactory.ParameterPart("C");
508
var
paramPartD = RoutePatternFactory.ParameterPart("D");
632
var
routePatternParameterPart = (
RoutePatternParameterPart
)templatePart.ToRoutePatternPart();
636
var
parameterPart = RoutePatternFactory.ParameterPart(name, defaults, RoutePatternParameterKind.Standard, policies);
659
var
routePatternParameterPart = (
RoutePatternParameterPart
)templatePart.ToRoutePatternPart();
663
var
parameterPart = RoutePatternFactory.ParameterPart(name, defaults, RoutePatternParameterKind.Standard, policies);
679
var
paramPartB = RoutePatternFactory.ParameterPart("B");
680
var
paramPartC = RoutePatternFactory.ParameterPart("C");
681
var
paramPartD = RoutePatternFactory.ParameterPart("D");
685
var actual = RoutePatternFactory.Segment((IEnumerable<
RoutePatternParameterPart
>)parts);
700
var
paramPartB = RoutePatternFactory.ParameterPart("B");
701
var
paramPartC = RoutePatternFactory.ParameterPart("C");
702
var
paramPartD = RoutePatternFactory.ParameterPart("D");
Patterns\RoutePatternParserTest.cs (4)
710
return Equals((
RoutePatternParameterPart
)x, (
RoutePatternParameterPart
)y);
726
private bool Equals(
RoutePatternParameterPart
x,
RoutePatternParameterPart
y)
Template\TemplateSegmentTest.cs (7)
24
var
paramPartB = RoutePatternFactory.ParameterPart("B");
25
var
paramPartC = RoutePatternFactory.ParameterPart("C");
26
var
paramPartD = RoutePatternFactory.ParameterPart("D");
37
Assert.IsType<
RoutePatternParameterPart
>(routePatternPathSegment.Parts[0]);
38
Assert.Equal(paramPartC.Name, ((
RoutePatternParameterPart
)routePatternPathSegment.Parts[0]).Name);
43
Assert.IsType<
RoutePatternParameterPart
>(routePatternPathSegment.Parts[3]);
44
Assert.Equal(paramPartB.Name, ((
RoutePatternParameterPart
)routePatternPathSegment.Parts[3]).Name);