سؤال

I'm storing an image in the blobstorage and information about that image in the tablestorage. The table rowkey is the image name. I want to change the image description(rowkey) for the selected item.

//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;
        }
    }

I've debugged the program and i can see that the imagedescription and the new imagedescription is right, but it seems like it's not saving the change.

Thank you for helping me. I'm still a newbie @azure so be patient with me:)

هل كانت مفيدة؟

المحلول

You need to write the changes you've made to Azure--which you're not doing. If you want to merge the changes, you should use the Merge operation. If you intend to replace the entire entity, you can use the Replace operation. To use the Replace operation, you can do something like:

TableOperation replaceOperation = TableOperation.Replace(entity);
table.Execute(replaceOperation);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top