In this post I will talk about how you can consume your ADO.NET Data Services. My examples will be based on WPF.
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 Consuming ADO.NET Data Services in WPF
Consuming in WPF
Creates a WPF application named MyWPFApplication.
Add a reference to your Data Service, right click on MyWPFApplication project, and select Add service reference. A windows appears, define the address, rename the namespace with MyDataServiceProxy and click on OK button.
In MainWindow.xaml.cs, write the following code:
In the loaded event, instantiate your DataService. Create a simple request using Linq syntax and put this query into the DataContext.
In MainWindow.xaml, bind the data grid with the DataContext :
Press F5 and here is the result:
This post shows how easy it is to consume Data Services with WPF. Just few code lines are needed 😉