How to efficiently handle Where and OrderBy clauses

Posted by Goran on Stack Overflow See other posts from Stack Overflow or by Goran
Published on 2011-03-20T16:05:39Z Indexed on 2011/03/20 16:10 UTC
Read the original article Hit count: 248

My business layer passes all the required information to UI layer. From what I have read, in general, best practice is to send fetched data to UI layer, and to avoid passing queries like ObjectQuery. My problem with this approach is next:

If I am to make a flexible business layer, then I should allow UI to sort the data anyway it requires. Fetching sorted data from database, and then resorting them in UI is kind of bad practice for me, so the only way is to somehow

So what are my options? Is there a way to make it like this:

public void OrderByMethod(params ...) { .... }

so I can call it like this:

OrderByMethod(MyEntity.Property1, MyEntity.Property2 descending....);

Thanks, Goran

© Stack Overflow or respective owner

Related posts about c#-4.0

Related posts about entity-framework-4