Dynamic Ordering

Jun 3, 2014 at 11:25 AM
Edited Jun 3, 2014 at 5:44 PM
I have a requirement where I would like to be able to dynamically define the query's OrderBy clause. For example, the user interface might allow the user to select one or more field names and whether the field's sort order should be ascending or descending. The code would then iterate through the selections and add the required sort statement to the query as it goes.

I have achieved something similar to this using IQueryable in basic LINQ, but I am having a problem translating this to work with the ordering mechanism in this library.

Any advice direction would be much appreciated.
Jun 3, 2014 at 6:59 PM
If this is a web app, you should leverage OData for this, it will allow you to pass in your sort parameter as a string, and OData will handle the getting this into IQueryable.
Marked as answer by lelong37 on 6/3/2014 at 10:59 AM
Oct 5, 2014 at 10:35 PM
Again apologies if this is out of turn - but why not look at NRepository on codeplex. It has the functionanlity already in there to do dynamic ordering