Created
April 14, 2014 05:29
-
-
Save aaronpowell/10618558 to your computer and use it in GitHub Desktop.
Number of document type properties grouped by document type and ordered by the number of documents using them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CmsPropertyTypes | |
| .GroupBy(pt => pt.ContentTypeId) | |
| .Join(CmsDocumentTypes, x => x.Key, x => x.ContentTypeNodeId, (pts, dt) => new { | |
| Property = pts, | |
| DocumentType = dt | |
| }) | |
| .Join(UmbracoNodes, x => x.DocumentType.ContentTypeNodeId, x => x.Id, (x, n) => new { | |
| x, | |
| n.Text | |
| }) | |
| .Select(x => new { | |
| x.x.Property.Key, | |
| x.Text, | |
| PropertyCount = x.x.Property.Count(), | |
| DocCount = CmsContents.Where(c => c.ContentType == x.x.Property.Key).Where(c => !c.Node.Trashed).Count() | |
| }) | |
| .Distinct() | |
| .OrderByDescending(x => x.DocCount) | |
| .ThenBy(x => x.PropertyCount) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment