Answered by:
My proxy classes dont use DataServiceCollection

Question
-
I'm having issues with my generated data service proxy classes, generated when I add a web service reference. All collections are using the System.Collections.ObjectModel.Collection class, not System.Data.Services.Client.DataServiceCollection.
I'm using the latest (as of 2 weeks ago) version of vs2010, and just to be sure I've installed the .Net 3.5 SP1 System.Data.Services bugfix & environment variables mentioned in step 2 of this tutorial: http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx.
My service is implemented in .Net 4.0, my client WPF app is targeting .Net 3.5. When I add a service reference in vs2010, the generated class' collections use System.Collections.ObjectModel.Collection. This means I cannot track changes. When I use C:\WINDOWS\Microsoft.NET\Framework\v3.5\datasvcutil.exe to generate classes (with arguments of /dataservicecollection /version:2.0) - I get a class that does use System.Data.Services.Client.DataServiceCollection.
What is wrong with my vs2010 setup, or what am I doing wrong?
Tuesday, May 4, 2010 8:00 AM
Answers
-
In the VS, can you add the parameters section as shown below to the .svcmap file:
<ReferenceGroup>
...
<Parameters>
<Parameter Name="UseDataServiceCollection" Value="true" />
<Parameter Name="Version" Value="2.0" />
</Parameters>
<ReferenceGroup>Once you are done, please right click on the "Service Reference" and say "Update service reference". Hopefully, you should see the right collections getting generated.
Hope this helps.
Thanks
Pratik
This posting is provided "AS IS" with no warranties, and confers no rights.- Proposed as answer by Pratik Patel - MSFTModerator Wednesday, May 5, 2010 5:00 PM
- Marked as answer by Simon Hazelgrove Wednesday, May 5, 2010 10:56 PM
Wednesday, May 5, 2010 5:00 PMModerator
All replies
-
Make sure you are using the latest update for 3.5 SP1. You can download it from here: http://www.microsoft.com/downloads/details.aspx?familyid=79d7f6f8-d6e9-4b8c-8640-17f89452148e&displaylang=en (windows7/windows2008R2) or here http://www.microsoft.com/downloads/details.aspx?familyid=4B710B89-8576-46CF-A4BF-331A9306D555&displaylang=en (other OSes). (here is the link to our blog that is announcing this release http://blogs.msdn.com/astoriateam/archive/2010/01/27/data-services-update-for-net-3-5-sp1-available-for-download.aspx) With this version you should not need any environment variables to get DataServiceCollection. Also note that before .NET Framework 4 ObservableCollection was not available on IA64 platform so you won't be able to get DataServiceCollection on IA64. PawelTuesday, May 4, 2010 8:03 PM
-
Make sure you are using the latest update for 3.5 SP1. You can download it from here: http://www.microsoft.com/downloads/details.aspx?familyid=79d7f6f8-d6e9-4b8c-8640-17f89452148e&displaylang=en (windows7/windows2008R2) or here http://www.microsoft.com/downloads/details.aspx?familyid=4B710B89-8576-46CF-A4BF-331A9306D555&displaylang=en (other OSes). (here is the link to our blog that is announcing this release http://blogs.msdn.com/astoriateam/archive/2010/01/27/data-services-update-for-net-3-5-sp1-available-for-download.aspx) With this version you should not need any environment variables to get DataServiceCollection. Also note that before .NET Framework 4 ObservableCollection was not available on IA64 platform so you won't be able to get DataServiceCollection on IA64. Pawel
Pawel,Thanks for the reply. I have already installed the update for 3.5 SP1 - this is the 'bugfix' I mentioned - couldnt find the proper name / link when writing the post :) What I'm unclear on is wether this update is necessary if I have (& am using) the release version of VS2010?
I've re-run the update anyway, buit I'm still getting System.Collections.ObjectModel.Collection in my proxy classes.
My environment is all x86.
Tuesday, May 4, 2010 10:42 PM -
In the VS, can you add the parameters section as shown below to the .svcmap file:
<ReferenceGroup>
...
<Parameters>
<Parameter Name="UseDataServiceCollection" Value="true" />
<Parameter Name="Version" Value="2.0" />
</Parameters>
<ReferenceGroup>Once you are done, please right click on the "Service Reference" and say "Update service reference". Hopefully, you should see the right collections getting generated.
Hope this helps.
Thanks
Pratik
This posting is provided "AS IS" with no warranties, and confers no rights.- Proposed as answer by Pratik Patel - MSFTModerator Wednesday, May 5, 2010 5:00 PM
- Marked as answer by Simon Hazelgrove Wednesday, May 5, 2010 10:56 PM
Wednesday, May 5, 2010 5:00 PMModerator -
Thanks Pratik, that has fixed the problem, now I dont need to rely on datasvcutil.exe.
Any suggestions to why this isnt default behaviour in vs2010 (or at least my version)? Or is this by design?
Wednesday, May 5, 2010 10:58 PM -
We cannot change the default behaviour in 3.5. Hence when you are using vs2010, targetting 3.5, and have WCF data service 3.5 SP1 update installed, we put these parameters in the datasvcmap file, but these values are set to default values - for version, its set to 1.0 and 'false' for collections. Otherwise, this will become breaking change.
Thanks
Pratik
This posting is provided "AS IS" with no warranties, and confers no rights.Thursday, May 6, 2010 2:54 PMModerator