Projections sorting: orderby on multiple properties chosen by user.

Topics: General, Writing modules
Nov 5, 2012 at 1:00 PM

I'm trying to create a ISortCriterionProvider so that users can sort a list on publishdate OR a dynamic property ViewCount (the view count of the content item).

Because I thought you can only properties in the orderby I've created a new property in the belonging part and filling in a contenthandler. The problem with this is I can only pass a record in the context.Query.OrderBy statement. Is there another way arround this?

I'm trying to do something like:

context.Query.OrderBy(alias => alias.ContentPartRecord(typeof(ArticlePart)), x => x.Asc("ViewCount"))

The viewcount is dynamically retrieved and for each user and content item in query different.