Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Question: TemplateMatcher and InlineConstraint #362

Closed
@dodyg

Description

@dodyg

Does TemplateMatcher ignore the InlineConstraints specified in a TemplatePart by design?

            var segment = new TemplateSegment();
            segment.Parts.Add(TemplatePart.CreateLiteral("page"));

            var segment2 = new TemplateSegment();
            segment2.Parts.Add(TemplatePart.CreateParameter("id",
               isCatchAll: false,
               isOptional: false,
               defaultValue: null,
               inlineConstraints: new InlineConstraint[] { new InlineConstraint("int") }));

            var segments = new TemplateSegment[] {
                segment,
                segment2
            };

            var template = new RouteTemplate("page", segments.ToList());
            var templateMatcher = new TemplateMatcher(template, new RouteValueDictionary());

The templateMatcher at above code will return true for both /page/10 and /page/BBB.

Full code is here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions