当前位置: 首页>>代码示例>>C#>>正文


C# RouteValueDictionary.Union方法代码示例

本文整理汇总了C#中RouteValueDictionary.Union方法的典型用法代码示例。如果您正苦于以下问题:C# RouteValueDictionary.Union方法的具体用法?C# RouteValueDictionary.Union怎么用?C# RouteValueDictionary.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteValueDictionary的用法示例。


在下文中一共展示了RouteValueDictionary.Union方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRoute

        public static void RegisterRoute(RouteCollection route)
        {
            route.RouteExistingFiles = true;
            route.LowercaseUrls = true;
            route.Ignore("{resource}.ashx/{*pathInfo}");
            route.Ignore("{resource}.axd/{*pathInfo}");

            RouteValueDictionary defaultValue = new RouteValueDictionary { { "pages", "login.aspx" } };
            RouteValueDictionary contains = new RouteValueDictionary { { "pages", @"[a-zA-Z0-9/]*" } };

            //route.Add("ashx", new Route("{path}.ashx", new PageRouteHandler("~/{path}.ashx")));
            //管理员页面
            route.MapPageRoute(
                "admin-login",
                "admin/",
                "~/admin/login.aspx",
                true
                );

            route.MapPageRoute(
                "admin",
                "admin/{pages}.aspx",
                "~/admin/{pages}.aspx",
                true,
                defaultValue, contains
                );

            route.MapPageRoute(
                "admin2",
                "admin/{pages}",
                "~/admin/{pages}.aspx",
                true,
                defaultValue, contains
                );

            //route.Add("admin", new Route("admin/", new AdminRouteHandler()));

            RouteValueDictionary pageIndex = new RouteValueDictionary { { "pageIndex", "1" } };
            RouteValueDictionary pageIndexC = new RouteValueDictionary { { "pageIndex", @"^[1-9][0-9]{0,10}$" } };

            RouteValueDictionary otherName = new RouteValueDictionary { { "othername", "" } };
            RouteValueDictionary otherNameC = new RouteValueDictionary { { "othername", @"^((?!\S*?[\.])(?!\S*?[\-_\.]{2,})[a-zA-Z0-9\-\._]{0,}[^\.])?$" } };

            RouteValueDictionary all = new RouteValueDictionary {
                 { "prev", "" },
                 { "pageIndex", "1" },
                 { "othername", "" }
            };
            RouteValueDictionary allC = new RouteValueDictionary {
                { "prev", PREV },
                {"pageIndex",PAGE_INDEX},
                {"othername",OTHER_NAME}
            };

            var p = new RouteValueDictionary(otherName.Union(pageIndex));

            //首页
            route.Add(
                "default",
                new Route("", new BulaqRouteHandler())
                );

            //route.Add(
            //     "alll1", new Route("{prev}/{pageIndex}", all, allC, new BulaqRouteHandler())
            //    );
            route.Add(
                 "defaultRoute1", new Route("{pageIndex}", new RouteValueDictionary { { "pageIndex", "1" } }, new RouteValueDictionary { { "pageIndex", PAGE_INDEX } }, allC, new BulaqRouteHandler())
                );

            route.Add(
                 "defaultRoute", new Route("{prev}/{othername}/{pageIndex}", all, allC, new BulaqRouteHandler())
                );

            //自定义页面
            route.Add("custompage", new Route("{othername}", otherName, otherNameC, new BulaqRouteHandler()));
        }
开发者ID:abduwaris,项目名称:BulaqCMS,代码行数:76,代码来源:RouteConfig.cs

示例2: Combine

 public static RouteValueDictionary Combine(RouteValueDictionary v1, RouteValueDictionary v2)
 {
     return new RouteValueDictionary(v1.Union(v2).ToDictionary(x => x.Key, y => y.Value));
 }
开发者ID:JoeBuntu,项目名称:Inventory,代码行数:4,代码来源:RouteValueCombiner.cs


注:本文中的RouteValueDictionary.Union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。