Understanding Server-Driven Paging
The new version of WCF Data Services introduced by .NET 4.0 presents a new feature known as server-driven paging. This feature enables paging data directly on the server and provides developers the ability of specifying how many items a page must return, also offering an Uri for browsing the next page. To enable server-driven paging, you simply invoke the DataServiceConfiguration.SetEntitySetPageSize
method that requires specifying the entity set name and the number of items per page. The following code demonstrates this:
config.SetEntitySetPageSize("Orders", 4)
If you now start the service and try to fetch all orders, you get the result shown in Figure 42.10.
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.