[输入 azure 表 noob] 我能找到的有关 Azure 表存储的所有文章都指定了 Microsoft.WindowsAzure.StorageClient 中与 TableServiceContext 类相关的 AddObject 方法。不幸的是,当我尝试引用AddObject和SaveChanges方法时,VS说没有这样的方法。这是我的代码:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString")
);
CloudTableClient tableClient = new CloudTableClient(storageAccount.TableEndpoint.ToString(), storageAccount.Credentials);
tableClient.CreateTableIfNotExist("ODATImageResizeErrors");
TableServiceContext context = tableClient.GetDataServiceContext();
ImageResizeErrorEntity entity = new ImageResizeErrorEntity();
entity.ErrorDescription = "Error resizing image";
entity.InnerException = ex.InnerException.ToString();
entity.ImageTypeId = imageTypeId;
entity.SkuId = skuId;
entity.RowKey = Guid.NewGuid().ToString();
entity.PartitionKey = "Errors";
这是我收到的完整错误:
感谢您的帮助 P.S.:我确实确保我的 Windows Azure SDK 是最新的,我的 StorageClient DLL 是 v1.1.0.0
最佳答案
您是否有对 System.Data.Services.Client.dll 的引用以及它的 using 声明?
关于Azure 表将行插入 TableServiceContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10420164/