Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created April 14, 2014 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpowell/10609659 to your computer and use it in GitHub Desktop.
Save aaronpowell/10609659 to your computer and use it in GitHub Desktop.
Umbraco document types grouped by the count of pages that use it (run via LINQPad)
(from dt in CmsDocumentTypes
join n in UmbracoNodes on dt.ContentTypeNodeId equals n.Id
select new {
n.Id,
n.Text,
Docs = CmsContents.Where(c => c.ContentType == n.Id).Where(c => !c.Node.Trashed).Count(),
IsNested = n.ParentID != -1
})
.Distinct()
.GroupBy(x => x.Docs)
.Select(x => new {
x.Key,
Value = x.OrderBy(y => y.IsNested).ThenBy(y => y.Id)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment