Microsoft.Data.Services.Client.dll vs System.Data.Services.Client.dll
I'm trying to use WCF Data Services and a little confused what library should I reference to interact with WCF Data Services: Microsoft.Data.开发者_JAVA技巧Services.Client.dll or System.Data.Services.Client.dll.
What is the difference between them? In which case should I use each of them?
When trying to add references to both of them I get a compiler error:
The type 'System.Data.Services.Client.DataServiceContext' exists in both 'e:\Program Files\WCF Data Services Mar 2011 CTP2\bin.NETFramework\Microsoft.Data.Services.Client.dll' and 'e:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.Services.Client.dll'
System.Data.Services.Client.dll is part of the base framework that ships with .NET 3.5 and upwards. The Microsoft.Data.Services.Client.dll is an updated version of this library (from your directory paths I see you're using the March 2011 CTP) which is not yet part of the base .NET installation package and contains any new features since the base release.
So if you're looking to use some of the latest features include the Microsoft dll. If you're just after base functionality (that will be 100% supported by anything with the proper .NET framework installed) use the System dll.
Here's a blog article outlining the difference between the Microsoft and System namespaces: http://blogs.msdn.com/b/brada/archive/2008/11/16/what-does-that-net-namespace-mean-system-and-microsoft.aspx
If you do need to use system.data.services and system.data.services.client, make sure to explicitly remove the microsoft variants i.e. right-clicking references -> right click and remove the microsoft ones.
精彩评论