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.
-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.
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.