Exemple #1
0
 /// <summary>
 /// 约束指定参数必须符合正则表达式
 /// </summary>
 /// <param name="name"></param>
 /// <param name="pattern"></param>
 /// <returns></returns>
 public IRouteGroup Where(string name, string pattern)
 {
     options.Where(name, pattern);
     for (int i = 0; i < routes.Count; i++)
     {
         routes[i].Where(name, pattern, false);
     }
     return(this);
 }
Exemple #2
0
 /// <summary>
 /// 约束指定参数必须符合正则表达式
 /// </summary>
 /// <param name="name">参数名</param>
 /// <param name="pattern">约束的正则表达式</param>
 /// <returns>当前路由组实例</returns>
 public IRouteGroup Where(string name, string pattern)
 {
     Guard.Requires <ArgumentNullException>(name != null);
     options.Where(name, pattern);
     for (var i = 0; i < routes.Count; i++)
     {
         routes[i].Where(name, pattern, false);
     }
     return(this);
 }
Exemple #3
0
 /// <summary>
 /// 合并where
 /// </summary>
 /// <param name="options">外部路由配置</param>
 private void MergeWhere(RouteOptions options)
 {
     if (wheres == null)
     {
         return;
     }
     foreach (var kv in wheres)
     {
         options.Where(kv.Key, kv.Value, false);
     }
 }
Exemple #4
0
 /// <summary>
 /// 约束指定参数必须符合指定模式才会被路由
 /// </summary>
 /// <param name="name"></param>
 /// <param name="pattern"></param>
 /// <returns></returns>
 public IRoute Where(string name, string pattern, bool overrided = true)
 {
     options.Where(name, pattern, overrided);
     return(this);
 }
Exemple #5
0
 /// <summary>
 /// 约束指定参数必须符合指定模式才会被路由
 /// </summary>
 /// <param name="name">名字</param>
 /// <param name="pattern">约束参数</param>
 /// <param name="overrided">是否覆盖</param>
 /// <returns>路由条目实例</returns>
 public IRoute Where(string name, string pattern, bool overrided = true)
 {
     Guard.Requires <ArgumentNullException>(name != null);
     options.Where(name, pattern, overrided);
     return(this);
 }