Windows Azure更新表行键
我正在blobstorage中存储一个图像,并在tablestorage中存储关于该图像的信息。表行键是图像名称。 我想更改所选项目的图像描述(行键)Windows Azure更新表行键,azure,azure-table-storage,Azure,Azure Table Storage,我正在blobstorage中存储一个图像,并在tablestorage中存储关于该图像的信息。表行键是图像名称。 我想更改所选项目的图像描述(行键) //string name is the bloburl, string description is the new image description public ActionResult UpdateImageDescription(string Name, string ImageDescription) { //Get blo
//string name is the bloburl, string description is the new image description
public ActionResult UpdateImageDescription(string Name, string ImageDescription)
{
//Get blob url
Uri bloburi = new Uri(Name);
string filename = System.IO.Path.GetFileName(bloburi.LocalPath);
//Get tabledata and make it a list
CloudTable table = tableStorageServices.GetCloudTable();
TableQuery<ImageEntity> query = new TableQuery<ImageEntity>();
foreach (ImageEntity entity in table.ExecuteQuery(query))
{
//find the matching urls
if (bloburi.ToString() == entity.Url)
{
entity.ImageDescription = ImageDescription;
break;
}
}
//string name是bloburl,string description是新的图像描述
public ActionResult UpdateImageDescription(字符串名称、字符串图像描述)
{
//获取blob url
Uri bloburi=新Uri(名称);
字符串filename=System.IO.Path.GetFileName(bloburi.LocalPath);
//获取tabledata并将其列为列表
CloudTable=tableStorageServices.GetCloudTable();
TableQuery=新建TableQuery();
foreach(表中的ImageEntity.ExecuteQuery(查询))
{
//查找匹配的URL
if(bloburi.ToString()==entity.Url)
{
entity.ImageDescription=图像描述;
打破
}
}
我已经调试了这个程序,我可以看到imagedescription和新的imagedescription是正确的,但它似乎没有保存更改
谢谢你的帮助。我还是@azure的新手,所以请耐心等待我:)你需要编写你对azure所做的更改——你没有这样做。如果你想合并更改,你应该使用
合并操作。如果你想替换整个实体,你可以使用替换操作。要使用Replace
操作时,您可以执行以下操作:
TableOperation replaceOperation = TableOperation.Replace(entity);
table.Execute(replaceOperation);
您需要写入对Azure所做的更改--您没有这样做。如果要合并更改,应使用合并
操作。如果要替换整个实体,可以使用替换
操作。要使用替换
操作,可以执行以下操作:
TableOperation replaceOperation = TableOperation.Replace(entity);
table.Execute(replaceOperation);
您需要写入对Azure所做的更改--您没有这样做。如果要合并更改,应使用合并
操作。如果要替换整个实体,可以使用替换
操作。要使用替换
操作,可以执行以下操作:
TableOperation replaceOperation = TableOperation.Replace(entity);
table.Execute(replaceOperation);
您需要写入对Azure所做的更改--您没有这样做。如果要合并更改,应使用合并
操作。如果要替换整个实体,可以使用替换
操作。要使用替换
操作,可以执行以下操作:
TableOperation replaceOperation = TableOperation.Replace(entity);
table.Execute(replaceOperation);
啊,谢谢。我希望我能投票给你,但我没有分数。@user3276084你不能给你自己的问题的答案打分。答案?啊,谢谢。我希望我能投票给你,但我没有分数。@user3276084你不能给你自己的问题打分。答案?啊,谢谢。我希望我能投票给你,但我没有分数没有分数。@user3276084你不能为你自己的问题标记答案答案?啊,谢谢你这么做了。我希望我能投票支持你,但我没有分数。@user3276084你不能为你自己的问题标记答案答案答案吗?