In this post, I’ll give you some tips interesting that helped me in my several projects.
For more information on Data Services, I suggest you to read my previous posts:
- How to create an ADO.NET Data Services with Visual Studio 2010 beta2
- How to request your ADO.NET DataServices
- Operations and Interceptors
- How to consume my ADO.NET Data Services in WPF
TIPS 1 : ADO.NET Data Services CTP 1.5 CTP 2
- Better data binding;
- Row count;
- Server Page Driven;
-> One of the major feature of this version is to allow cross domain access to your Data Services from your Silverlight application.
Here you can access to a description of this feature written in the ADO.NET Data Services Team Blog.
TIPS 2 : Returning hierarchical data
A great advantage of returning hierarchical in advance to reduce the number of server calls especially when you know that the hierarchical data is needed.
In the following example, the request will return a specific product:
This request will returns the specific ProductSubCategory entity of the product and the ProductCategory of this ProductSubcategory.
TIPS 3 : Deferred loading
In opposition to hierarchical data return in a single call, when the size of data to return is too heavy, you should use deferred loading.
In this example, I will return the ProductSubcategory of the product only when needed.
BeginLoadProperty requires four parameters, the entity used for deferred loading, the name of the property used in the deferred mechanism, the callback ant the context.
The callback method will end the asynchronous system.
TIPS 4 : Batching requests
One other great feature of Data Services is batching. it allows you to request in a same time several requests to the server and to return the result only in one time.
This example shows how to execute two requests on the server with only one server access. You can check using fiddler to confirm 🙂
Here is an interesting post from ADO.NET Data Services Team Blog.