Ok, I found this, which will allow me to do this:
public IList<Item> GetItems(string orderbyColumn)
{
return _repository.GetItems().OrderBy(orderByColumn).ToList();
}
Is this the best way to do “dynamic” ordering? I want to be able to pass the column name as a string (and the sort direction) to my Service, and have it order the correct way.
If you’re just after dynamic sorting without the full Dynamic-Linq stuff you can check out a post I wrote about this a while back: click
EDIT: I don’t really blog anymore so here’s the actual extension method: