Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 使用Microsoft.WindowsAzure.StorageClient.TableServicesContext并检测并发更新冲突_.net_Azure Table Storage_Optimistic Concurrency - Fatal编程技术网

.net 使用Microsoft.WindowsAzure.StorageClient.TableServicesContext并检测并发更新冲突

.net 使用Microsoft.WindowsAzure.StorageClient.TableServicesContext并检测并发更新冲突,.net,azure-table-storage,optimistic-concurrency,.net,Azure Table Storage,Optimistic Concurrency,问题是System.Data.Services.Client.dll和Microsoft.Data.Services.Client.dll中都存在某些类(DataServiceClientException/DataServiceRequestException/DataServiceResponse)。最简单的方法就是去做。不幸的是: 无法删除System.Data.Services.Client.dll,因为它是使用Microsoft.WindowsAzure.StorageClient.

问题是System.Data.Services.Client.dll和Microsoft.Data.Services.Client.dll中都存在某些类(DataServiceClientException/DataServiceRequestException/DataServiceResponse)。最简单的方法就是去做。不幸的是:

  • 无法删除System.Data.Services.Client.dll,因为它是使用Microsoft.WindowsAzure.StorageClient.TableServicesContext所必需的
  • Azure上的Microsoft.WindowsAzure.StorageClient.TableServicesContext需要Microsoft.Data.Services.Client.dll
通常这两个库一起工作很好。但是,从中实现代码以检测并发冲突会导致错误:

Error   1   The type 'System.Data.Services.Client.DataServiceRequestException' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
Error   2   The type 'System.Data.Services.Client.DataServiceResponse' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
Error   3   The type 'System.Data.Services.Client.DataServiceClientException' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
因为无法访问
System.Data.Services.Client.DataServiceClientException
DataServiceRequestException
DataServiceResponse
类,因为它们存在于两个库中。使用Microsoft.WindowsAzure.StorageClient.TableServicesContext时如何检测并发更新冲突?

解决方案是使用C#的功能

  • 展开项目的“引用”部分

  • 右键单击System.Data.Services.Client并选择属性

  • 将别名从“全局”更改为“系统”或其他名称

  • 项目建设良好