protected void AddDefaultRouteConstraint(string keyRegex, object constraint)
 {
     if (!DefaultRouteConstraints.ContainsKey(keyRegex))
     {
         DefaultRouteConstraints.Add(keyRegex, constraint);
     }
 }
示例#2
0
 /// <summary>
 /// Automatically applies the specified constaint against url parameters
 /// with names that match the given regular expression.
 /// </summary>
 /// <param name="keyRegex">The regex used to match url parameter names</param>
 /// <param name="constraint">The constraint to apply to matched parameters</param>
 public void AddDefaultRouteConstraint(string keyRegex, IRouteConstraint constraint)
 {
     if (!DefaultRouteConstraints.ContainsKey(keyRegex))
     {
         DefaultRouteConstraints.Add(keyRegex, constraint);
     }
 }