--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To post to this group, send email to castle-pro...@googlegroups.com
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---
--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=.
public class PatternRouteWithParameters : PatternRouteBut unfortunately only one way - I have not found any way to have ${Url.For()} prefer, without the help of the named parameter, the specific url where it applies and the unspecific, where not.
{
private readonly Dictionary<string, string> parameters;
public PatternRouteWithParameters(string pattern, Dictionary<string, string> parameters)
: base(pattern)
{
this.parameters = parameters;
}
public PatternRouteWithParameters(string name, string pattern, Dictionary<string, string> parameters)
: base(name, pattern)
{
this.parameters = parameters;
}
public override int Matches(string url, IRouteContext context, RouteMatch match)
{
var matchResult = base.Matches(url, context, match);
if (parameters != null)
foreach (var key in parameters.Keys)
match.Parameters.Add(key, parameters[key]);
return matchResult;
}
}