Commit Graph

18 Commits

Author SHA1 Message Date
Ryan Nowak 736b49294d Add Template abstraction
This change adds the Template as a top level abstraction. URL templating
is now a two-stage process.

First you use a 'key' to look up a Template, then you use the Template
to create the URL.

This change also has some cleanup of the way RoutePatternBinder gets
instantiated. I added a factory service so that most of the complex
things can be made internal to Dispatcher. Now it's much easier to
constuct and use. These impacts some pubternal APIs that we already
broke, but makes them actually nice :)

Also cleaned up some tests and fixed one that was broken and not
running.
2017-10-25 22:15:24 -07:00
Ryan Nowak 2d661396df Port TemplateBinder to dispatcher 2017-10-25 14:28:20 -07:00
Jass Bagga eebc7db2ca Use RoutePatternMatcher logic in TemplateMatcher (#484) 2017-10-25 14:16:04 -07:00
Ryan Nowak bd517f891f Support conversions from RouteTemplate -> RoutePattern 2017-10-20 16:58:14 -07:00
Ryan Nowak 08a64048da Redesign public API for templates
-Renamed RouteTemplate -> RoutePattern
-Made immutable
-Added Builder
-Lots of fixes to parser to support new design

There are a few small issues logged for follow-up but this is mostly in
the place I want it design-wise.
2017-10-19 09:41:45 -07:00
Jass Bagga 3a5cd6dd25 Port TemplateParser to Dispatcher project (#473)
Addresses #466
2017-10-17 11:52:26 -07:00
Nate McMaster 6b3d42f6bd Minor changes to test code to resolve xUnit2013 build errors 2017-10-05 15:26:36 -07:00
Joonas Westlin a18f59ab88 Changed expected exception message to the one defined in Resources.resx.
Removed the Debug.Assert as that caused the test runner to crash as in
this case the preceding part is not a literal.
Fixes the test runner crash.
2017-05-24 08:23:20 -07:00
Joonas Westlin f457c7b9d8 Changed expected parameter p2 to non-optional as it is non-optional in the template string.
Fixes test.
2017-05-24 08:23:20 -07:00
Nate McMaster d075f1bcea Upgrade test framework versions and fix test issues 2017-05-12 15:13:17 -07:00
Kiran Challa 755d436840 Fixed error message related to escaping curly braces. 2017-01-03 14:33:36 -08:00
Kiran Challa 4bfd663c45 [Fixes #370] Raw route values should be restored after template binder failing binding values when generating a url
- Reverted changes made in commit: 1c9a54aeb8
2017-01-03 13:23:36 -08:00
jacalvar 438ec83227 [Fixes #359] Routing is matching empty segments to parameters and defaults are wrong 2016-10-03 15:34:04 -07:00
Ryan Nowak e8ce0e7523 TreeRouter cleanup 2016-04-20 18:12:10 -07:00
Ryan Nowak 9cd3fe34a5 Improve tests for catch-all + defaults/nulls 2016-04-11 15:17:07 -07:00
Ryan Nowak a51c78da06 Remove dictionary alloc in routing
This changes TemplateMatcher to mutate RouteData.Values directly instead
of creating a new dictionary and then merging in values. This is one the
biggest single costs in routing in terms of both allocations and execution
time.

So Match now becomes TryMatch. This will dirty the state of the RVD, so
the caller needs to snapshot it before calling into it (handled
inside the TreeRouter or RouteCollection).

Some subtle changes were needed to how/when values are added to be
compatible with the existing tests. The general idea is that we add null
values for non-parameter defaults or catchalls, but only if they don't
trounce an existing value. This logic used to live in MergeValues but now
it's in TryMatch since TryMatch might be working from existing data.

Also fixed the .sln to avoid building a package that we use as shared
source.
2016-04-08 08:46:00 -07:00
N. Taylor Mullen 70d674410e Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:24:38 -08:00
N. Taylor Mullen ace4553d77 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:24:31 -08:00