查询Azure存储 - 代码问题



我对设置Azure表存储查询的前几行代码有问题。

我的代码是:

CloudStorageAccount account;
string CloudStorageAccountName = ConfigurationManager.AppSettings["StorageConnectionString"];
// Create the table client.
Microsoft.WindowsAzure.StorageClient.CloudTableClient tableClient = account.CreateCloudTableClient(); // conflicting
// Create the CloudTable object that represents the "people" table.
CloudTable table = tableClient.GetTableReference("people"); // conflicting

代码的第三行和第四行分别调用CreateCloudTableClient()GetTableReference()。我无法同时解决这些问题。

对于第一个语句,CreateCloudTableClient()WindowsAzure.StorageClient.dll返回CloudTableClient。第二个语句从同一DLL返回CloudTable。但是,DLL不包括一个称为CloudTable的类,只有WindowsAzure.Storage.Table.dll,因此该行上有一个运行GetTableReference()的编译错误。

如果我将CloudTableClient组件更改为Storage.Table.dll,则会在CreateCloudTableClient()上引发编译错误。因此,一种或另一种方法,我无法正常工作,这两个DLL正在战斗。该代码被引用了我的多篇文章,因此我不确定我在做什么错。我尝试使用var而不是类引用,但是我也有同样的问题。以某种方式,编译器将var解释为Storage.Table.CloudTable-为什么?超越我。我使用的是最新版本的SDK(2.7)。

根据MSDN,您要寻找的所有类都在Microsoft.WindowsAzure.Storage.dll中。

最新更新