Please share with your friends when you see this Blog.
MS Announced Web Application Took kit here is the Link where you can download the kits .
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.
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.
Now we asked server to return only 3 records. The below screenshot shows the result and also it provides the Link for next Page .
Suppose if we want to know total records we need to use $inlinecount operation. http://localhost:2600/AW.svc/Contact?$inlinecount=allpages
The ADO.NET Data Services Projection feature allows client to query subset of properties of Entity Set. This feature helps to optimize client applications bandwidth consumption and memory footprint. ADO.NET Data Services URI format by adding the $select query option to enable clients to explicitly define the properties to be returned.
Let’s see this in action. First download & Installed ADO.NET Data Services v1.5 CTP2. Download @ http://www.microsoft.com/downloads/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&displaylang=en
1) First Create ASP.NET Web Application Project.
2) Add ADO.NET Entity Data Model Template to the project. and follow the Wizard and create our Entity Model which we are going to expose as a Service.
3) Now we need to Add ADO.NET Data Service V1.5 CTP2 template
4) Now we need make changes to the .SVC as shown below. And browse the .Svc in browser
Here is the screenshot shows our ADO.NET service is Up and Running with Contact Entity set.
when you browse the following http://localhost:1888/AW.svc/Contact URL you get all Records with all properties of the contact Entity set as shown below.
Now we are coming actual part of this Blog post. Now let’s use projection feature to query Contact Entity Set FirstName, LastName &EmailAddress Properties.
Here is the URI format http://localhost:1888/AW.svc/Contact?$select=FirstName,LastName,EmailAddress and the result of the this query is
What’s included in CTP2?
1) Projections -You can now work with a subset of the properties of an entity.(URI format has been extended to express projections).
2) Data Binding: The data services client library for the .NET Framework 3.5 SP1 and Silverlight2 has been extended to support two-way data binding for WPF and Silverlight based applications.
3)Server Driven Paging (SDP): You can Limit or provided paging support for the query Result.
for More Information Visit the following URL @ http://www.microsoft.com/downloads/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&displaylang=en