- Support only PatternRoute rule
- Not be tied to Controller/actions
- Some great performance improvements on regexp usage
To do
- Implement ForDomain/ForSubdomain methods : the idea is to attach
routing rules per domain/subdomain if required (I need this)
- Named routes
- routing match to create urls
- Implement locking as routes might change during app's lifetime
The syntax has changed to
Simplest case:
RoutingModuleEx.Engine.Add(
new PatternRoute("/<area>/<controller>/[action]/[id]"));
RoutingModuleEx.Engine.Add(
new PatternRoute("/<controller>/[action]/[id]"));
File extensions are also supported
RoutingModuleEx.Engine.Add(
new PatternRoute("/<area>/<controller>.castle/[action]/[id]"));
RoutingModuleEx.Engine.Add(
new PatternRoute("/<controller>.castle/[action]/[id]"));
With defaults
RoutingModuleEx.Engine.Add(
new PatternRoute("/<area>/<controller>/[action]/[id]").
DefaultFor("action").Is("index"));
With restrictions:
RoutingModuleEx.Engine.Add(
new PatternRoute("/<area>/<controller>/[action]/[id]").
DefaultFor("action").Is("index").
Restrict("action").AnyOf("index", "list").
Restrict("id").ValidInteger);
--
Cheers,
hamilton verissimo
ham...@castlestronghold.com
http://www.castlestronghold.com/
Restrict("action").AnyOf("index", "edit", "create", "delete")
What is that getting us?
-d
--
cheers,
-d
If you dont use restrictions it gets more difficult, if not
impossible, to deal with rules that might be ambiguous.
On 12/31/07, Dru Sellers <d...@drusellers.com> wrote:
>
About your request... maybe:
RoutingModuleEx.Engine.Add(
new PatternRoute("/customers/<parentId>/orders/<id>/[action]").
DefaultFor("action").Is("index").
DefaultFor("controller").Is<OrderController>().
Restrict("action").AnyOf("index", "edit", "create", "delete").
Restrict("id").ValidInteger.
Restrict("parentId").ValidInteger));
Ok, not much better is it? I'm afraid a way to reuse base rules to
create compound ones might lead us to a very complex recursive
matching algorithm. As long as I dont have to write one, I'm fine with
it :-)
On 1/16/08, Felix Gartsman <gart...@gmail.com> wrote:
>
There are hacks, though
Is there a strong general consensus to use one over the other? If so which
one and why?
Thanks
Pete
BTW: AspView is promising too, though I didn't use it so far.
-Markus
I have not tried it yet, but a concern for me is that it's inherently
less flexible, no?
I'm judging here by my experience with regular WebForms in that matter.
I was kind of annoyed to manually declare all the properties i may
need in the template.
Yep.
/home.c/edit/1 (should work)
That should work. Just remove the interface attribute, it's not
necessary for a built in service.
> Or should I do this in global.asax / elsewhere / differently?
You can do through the global.asax
${Url.Link(group.Name, {'route':'GroupByName', 'params':group})}
On 1/30/08, Jan Limpens <jan.l...@gmail.com> wrote:
>
> It seems (and if I am correct Hamilton mentions this as well) that
> named patterns are not yet implemented.
> Is there any other way you could tell your app, which pattern to
> choose?
>
> Let's say there are a few quite similar routes
>
> new PatternRoute("ThemeByName", "/themes/[Name]")
> .DefaultForController().Is<ThemesController>()
> .DefaultForAction().Is("FindDetailByName");
>
> new PatternRoute("GroupByName", "/groups/[Name]")
> .DefaultForController().Is<ProductGroupsController>()
> .DefaultForAction().Is("FindProductGroupByName");
>
> new PatternRoute("ProductByName", "/products/[Name]")
> .DefaultForController().Is<ProductsController>()
> .DefaultForAction().Is("FindProductByName");
>
> then, on the view, assuming that both a ProductGroup and a Theme have
> a Name property
>
> ${Url.Link(group.Name, {'named':'GroupByName', 'params':group})}
> ${Url.Link(theme.Name, {'named':'ThemeByName', 'params':theme})}
>
> both render as "Theme", because that is what comes first.
>
> Any ideas?
>
> >
>