I have been using Linq-to-SQL for quite a while and now switched to dotConnect for Oracle using Entity Framework 4. I have several queries, where the user can select the field to sort on. I also apply a default sorting on several other columns. With Linq-to-SQL I was able to do something like this:
Code: Select all
// apply default sort
query = query.OrderBy(it => it.ColA).ThenBy(it => it.ColB);
switch (sortKey) {
case "ColC": query = query.OrderBy(it => it.ColC); break;
case "ColD": query = query.OrderBy(it => it.ColD); break;
}
I know, the simple workaround is to simply add the default sorting to all the sort operations, but this results in much less maintainable code and a bunch of redundancy. So, I was wondering, whether this might be a bug, that might be fixed in the near future.
Thanks,
Christoph