We recently released a CTP of the next set of things we are working on for ADO.NET Data Services. We are calling this new set of features v1.5 because they are built on top of ADO.NET Data Services v1.0. ADO.NET Data Services v1.0 was included as part of the .NET Framework 3.5 SP1 and so the CTP also was built to use .NET 3.5 SP1 and Visual Studio 2008 SP1. Microsoft recently released a beta of the next version of Visual Studio and the .NET Framework and even though the CTP was not built with the new Visual Studio it is still possible to use it.
The rest of this blog will walk you through the steps for using ADO.NET Data Services v1.5 CTP1 with Visual Studio 2010.
Part 1: The ADO.NET Data Service
Visual Studio 2010 includes the tooling required to build a Data Service, but by default it will build a v1.0 data service. If you have an application and you select “Add -> New Item” you will only have the option to choose a standard v1.0 Data Service.
Even though you have installed the ADO.NET Data Services v1.5 CTP1, the CTP1 Data Service option does not show up in the list as it does in Visual Studio 2008. To get around this restriction, we will create the data service and modify it to run using the v1.5 CTP1 runtime. Create the service normally and then examine the “References” node in the solution explorer. You will see that it has added references to System.Data.Services and System.Data.Services.Client.
To move to using the v1.5 CTP1 features, you must change those references to use the CTP1 assemblies. The first step is to remove those two references (use right-click). After removing the references, right-click the References node and select “Add Reference”. In the Add Reference dialog, select the “Browse” tab and move to the install location for ADO.NET Data Services CTP1. By default this is:
“C:\Program Files\ADO.NET Data Services V1.5 CTP1”.
Under the bin folder you will see the two assemblies, Microsoft.Data.Services.dll and Microsoft.Data.Services.Client.dll.
Select both assemblies and click OK. The references view should now look like this:
Your service will now use the CTP1 assemblies and have all of the CTP1 features. To prove this, I will try using a v1.5 CTP1 feature; I will run my service and navigate to the Customers entity set and add the $count segment. If I do this I should get back the count of Customers in my service.
I now have a v1.5 CTP1 version of my Data Service with all of the v1.5 features.
Step 2: The client.
Now that I have a v1.5 CTP1 service end-point, I want a v1.5 CTP1 client that can talk to my service. The client is a little trickier. I can use the same process on the client as I did on the service to update my assembly reference to point to the new client assembly and get a v1.5 client.
Where the client gets interesting is when I go to generate my client-side types that know how to speak to the v1.5 service. For both the Web Friendly Feeds and the databinding features of the v1.5 CTP1, I need special client-side types that can interpret Friendly Feeds and have the OnPropertyChanged and OnCollectionChanged events for binding. Now I could hand-craft my client side types to do this, but I would rather have auto-generated types based on my service metadata that do this for me.
Let’s walk through auto-generating v1.5 CTP1 client side types that work with my v1.5 CTP1 service. The first thing you should do is go through the “Add Service Reference” gesture and add a service reference to the service you created in Step 1.
For my client, I have created a WPF client and used the “Add Service Reference” gesture to create a set of proxy class that can talk to my Northwind Data Service from step 1.
I now have two problems.
To solve the first issue, I will go through the same process as in Step 1 and remove the reference to System.Data.Services.Client and replace it with a reference to Microsoft.Data.Services.Client (see step 1 for instructions).
I have solved issue 1 but I still have client side types that do not have the v1.5 CTP1 features. To solve this issue, I will need to manually create my Service Reference as the Add Service Reference dialog in Visual Studio 10 will always use the code generation utility that ships with Visual Studio 10. The v1.5 CTP1 shipped with a command-line utility named “DataSvcUtil.exe” that knows how to generate v1.5 CTP1 client side types. This utility is located in the same bin directory as the v1.5 assemblies we referenced before. So I will open a command prompt, navigate to that directory and run the DataSvcUtil.exe utility. The parameters are
The next step is to copy the output file (Reference.cs in my case) into the Service References folder of my visual studio project. I will overwrite the one visual studio created for me earlier.
I now have a client that uses the new v1.5 CTP1 features that can talk to my v1.5 CTP1 service all using Visual Studio 2010 Beta 1 and .NET 4.0 Beta 1.
ADO.NET Data Services, Program Manager
PingBack from http://microsoft-sharepoint.simplynetdev.com/using-adonet-data-services-v15-ctp1-with-visual-studio-2010-beta-1/
Is there a roadmap to the release of V1.5CTP and what is expected to be included in VS2010 RTM? We are keen to look into the new Offline Astoria features but again keen to know how all of these Items will be targetted for release.
Daily tech links for .net and related technologies - June 7, 2009 Web Development Implementing Incremental
i am trying to follow your sample but I get the an error 7001: method not found
While I am busy using the datasvcutil as directed in this example. Any suggestions ?