Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient azure azure

Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient


I was able to repro this problem fairly quickly. The Microsoft.WindowsAzure.StorageClient.Dll has direct reference dependency on System.Data.Service.Client.Dll as shown below so if you are going to use Azure Storage Client API you would have to reference System.Data.Service.Client.Dll in your application and sure you can not use oData 3.0 supplied by WCF 5.0 SDK. More info is posted in the SO question below:

WCF 5.0 and oData 3.0 API not work with azure table storage


You can use extern alias to differentiate between two type names that are identical apart from the assembly in which they are contained.

  1. Set an alias for System.Data.Services.Client - say SystemDataV4

    (See MSDN Blogs - Extern Alais Walkthrough)

  2. At the very top of your .cs file use

    extern alias SystemDataV4;

Then you can either have

using SystemDataV4.System.Data.Services.Client;

or

serviceContext.SaveChangesWithRetries(SystemDataV4.System.Data.Services.Client.SaveChangesOptions.ReplaceOnUpdate);

Note the prefix of the namespace with the alias, e.g. SystemDataV4.System.Data.Services...