I've been experiementing with using WCF and have written a WCF Service to provide the backend for a web site. I've encountered a problem when it comes to implementing server-side paging as all the examples I've found (such as http://msdn.microsoft.com/en-us/library/ee358711.aspx) all seem to use DataServiceQueryContinuation and WCF Data Services.
Whilst I appreciate I could write a WCF Data Service to return the data, it seems like extra complexity having a WCF Service for things like logins and updating user information and th开发者_C百科en a separate WCF Data Service for larger queries / reporting.
Would this be the standard practise or is there a built in mechanism for paging data via a method call from a WCF service?
EDIT
I've found a couple of possible methods of doing this, a simple method involving Linq's skip
and take
operators: Implementing pager through WCF service
and a more complicated method:
Best practice for WCF service with large amounts of data?
I had thought that there might be a way of using WCF Service to page data like you can with a WCF Data Service: http://msdn.microsoft.com/en-us/library/ee474245.aspx
Does anyone know if this is possible?
We are using a WCF service for all our communication with our back end server and we've implemnted paging by just passing a simple PaginDTO to a method call with properties like PageSize and CurrentPageIndex.
The result is a PagedDTO which contains the list of items and info about the total amount of pages.
We use the entity framework for our database and with Skip/Take this is really simple to implement.
Hope this helps :)
精彩评论