本文整理汇总了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));
}
}
示例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));
}
}