我对设置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
中。