【问题标题】:Using Microsoft.WindowsAzure.StorageClient.TableServicesContext and detecting concurrency update conflicts使用 Microsoft.WindowsAzure.StorageClient.TableServicesContext 并检测并发更新冲突
【发布时间】:2013-06-01 18:33:13
【问题描述】:

问题是 System.Data.Services.Client.dll 和 Microsoft.Data.Services.Client.dll 中都存在一些类(DataServiceClientException / DataServiceRequestException / DataServiceResponse)。简单的方法是use only one of those libraries。不幸的是:

  • 无法删除 System.Data.Services.Client.dll,因为它是使用 Microsoft.WindowsAzure.StorageClient.TableServicesContext 所必需的
  • Azure 上的 Microsoft.WindowsAzure.StorageClient.TableServicesContext 需要 Microsoft.Data.Services.Client.dll。

通常这两个库可以很好地协同工作。但是,执行here 中的代码来检测并发冲突会导致错误:

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.DataServiceClientExceptionDataServiceRequestExceptionDataServiceResponse 类无法访问,因为它们存在于两个库中。在使用 Microsoft.WindowsAzure.StorageClient.TableServicesContext 时如何检测并发更新冲突?

【问题讨论】:

    标签: .net azure-table-storage optimistic-concurrency


    【解决方案1】:

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

    1. 扩展项目的参考部分。

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

    3. 将别名从“全局”更改为“系统”或其他。

    项目构建良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多