I'm trying to figure how to efficiently use the mvc grid control with an Odata service. I'm using the grid in server mode. When I get the Odata data in the controller in the paging/sorting/searching Post ActionResult method I'm noticing varied problems.
Problem 1: If I get the data and call ToList() on it, it doesn't have deferred execution and loads all of the data without a Skip and Take (noticed via network trace).
Problem 2: If I give the data to the GridActions method without calling ToList() I noticed in a network trace that it calls the Odata service 2 times. One of the calls gets all of the data, the second call gets only the portion of the data needed for the page (ie applies filters to it and returns only the needed data).
The issue with Problem 1 is that I don't want to load all of the data every single time I page, search, sort, etc. The issue with Problem 2 is that in a paging method, I would expect it to only make one call to the server just to get only the data needed for the page using a skip and take.
So my question is how can I apply paging, sorting, searching, etc to the grid without returning all of the data every single time. I would like to return only the necessary data from my Odata source so that it is more efficient.