This is a migrated thread and some comments may be shown as answers.

[Solved] iqueryable for paging/filtering

2 Answers 333 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
maciej
Top achievements
Rank 1
maciej asked on 02 Feb 2011, 08:29 PM
I understand that the grid needs iqueryable to do automatic database side filtering/paging.  I'll soon be starting a rewrite of an intranet portal using asp mvc and trying to employ good design principles. I'll be using nhibernate and the repository pattern (using sharp architecture as a template).  Isn't exposing iqueryable to the controller (or even exposing it outside the data layer since it moves execution outside its bounds) bad practice? Bloating the repository with methods to do paging/filtering etc doesn't sound like fun to me either. I was considering doing it like the 'whocanhelpme' project and exposing iqueryable from data layer to service only which would then talk to the controllers. The service would get a "gridstate" and return a "gridmodel" (or possibly my own custom classes that would get mapped to the telerik implementations in the controller) which from what I  can understand would eliminate iqueryable out of the controllers. Is that possible?

I'm just wondering how anyone else has handled filtering/paging their data and trying to stick to ddd. Should I just screw it and return an iqueryable? Am I over-thinking the whole problem? I'll be the only developer and it's a relatively small/medium sized site if that helps.

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Feb 2011, 08:27 AM
Hello maciej,

 Perhaps other users should comment as well but here is my opinion:

I think that exposing an IQueryable is not such a big problem if you want paging, sorting, filtering and grouping to happen in the database. The other option is to implement custom binding and expose (and implement) paging, sorting and filtering in your repository. Still this is just my opinion and probably other users should give their feedback as well. By the way we have a sample application showing how to bind Telerik Mvc Grid to NHibernate in this code library entry.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
maciej
Top achievements
Rank 1
answered on 03 Feb 2011, 06:09 PM
Hi,

Thanks for the reply.  When I first looked at the custom binding examples it looked like a hassle to write all the code for every grid just to get sorting/filtering/paging...after looking further through the code and web service samples I realized I should be achieve most if not all functionality easily using "ToGridModel" then returning that to my controllers.
Tags
Grid
Asked by
maciej
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
maciej
Top achievements
Rank 1
Share this question
or