Ejemplo n.º 1
0
 /// <summary>
 /// Get ancestor categories.
 /// </summary>
 /// <param name="entryContent">The entry content.</param>
 /// <param name="contentLoader">The content loader.</param>
 /// <returns>Collection of category content.</returns>
 public static IEnumerable <NodeContent> GetAncestorCategories(
     this EntryContentBase entryContent, IContentLoader contentLoader)
 {
     return(entryContent.GetCategories()
            .SelectMany(parentLink =>
                        contentLoader.GetAncestors(parentLink)
                        .OfType <NodeContent>()
                        .Concat(new[] { contentLoader.Get <NodeContent>(parentLink) }))
            .Distinct(new NodeContentComparer()));
 }