Thursday, September 10, 2009

ADO.NET Data Services – Server Driven Paging (SDP).

In this post I am going to extend from my previous Post http://mstecharchitect.blogspot.com/2009/09/adonet-data-services-projections.html. In this post we are going to see how we can limit the query result with new  Server Driven Paging .

When you browse the .Svc file  the Services returns all the  records from the Contact Entity set as shown below. we may not need all the Records at once on the client side.

image

Now we are going to limit this result using  ADO.NT Data Service  SDP feature called Server Driven Paging. To enable this we need to make small code change as shown below.

The line config.SetEntitySetPageSize("*", 3); will do the magic.

image 

Now we asked server to return only 3 records. The below screenshot shows the result and also it provides the Link for next Page . 

image

Suppose if we want to know total records we need to use $inlinecount operation. http://localhost:2600/AW.svc/Contact?$inlinecount=allpages

image

Thanks(Nandri)

SreenivasaRagavan

No comments: