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


C# IPublishedContent.GroupBy方法代码示例

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


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

示例1: MapMemberRoute

        /// <summary>
        /// Create the member profile route - It's a fake page
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="nodeRoutePath"></param>
        /// <param name="nodesWithPath"></param>
        private static void MapMemberRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
 
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>(AppConstants.PropMemberUrlName)))
            {
                if (string.IsNullOrWhiteSpace(nodeSearch.Key))
                    continue;
                    
                var routeHash = nodeSearch.Key.GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    string.Format(MemberRouteName, routeHash),
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{membername}").TrimStart('/'),
                    new
                    {
                        controller = "DialogueMember",
                        action = "Show",
                        topicname = UrlParameter.Optional
                    },
                    new DialogueMemberRouteHandler(nodesWithPath));
            }

        }
开发者ID:ryan-buckman,项目名称:Dialogue,代码行数:30,代码来源:DialogueRoutes.cs

示例2: MapSearchRoute

        private static void MapSearchRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
        {
            //we need to group by the search url name and make unique routes amongst those,
            // alternatively we could create route constraints like we do for the tags/categories routes
            foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>("searchUrlName")))
            {
                //the hash needs to be the combination of the nodeRoutePath and the searchUrl group
                var routeHash = (nodeRoutePath + nodeSearch.Key).GetHashCode();

                //Create the route for the /search/{term} results
                routes.MapUmbracoRoute(
                    "articulate_search_" + routeHash,
                    (nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{term}").TrimStart('/'),
                    new
                    {
                        controller = "ArticulateSearch",
                        action = "Search",
                        term = UrlParameter.Optional
                    },
                    new ArticulateSearchRouteHandler(nodesWithPath));
            }
        }
开发者ID:kole9273,项目名称:Articulate,代码行数:22,代码来源:ArticulateRoutes.cs


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