Can i update RowKey or PartitionKey properties of entity in Azure Table Storage?
I thought yes or maybe just PartitionKey but now i am trying to do that(try to change RowKey or PartitionKey) and get error:
The remote server returned an error: (404) Not Found.
Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error:
(404) Not Found.
Source Error:
Line 143:
Line 144: var updateOperation = TableOperation.Replace(entity);
Line 145: _table.Execute(updateOperation);
Line 146: }
Line 147: }
var query = new TableQuery<CalculatorAccessTokenEntity>()
.Where(TableQuery.GenerateFilterCondition("AccessUrl",
QueryComparisons.Equal, url));
var newToken = GetUniqueKey(5);//get some random string of length 5
entity.PartitionKey = newToken;
// Try to use Merge here also but unsuccessful
var updateOperation = TableOperation.Replace(entity); _table.Execute(updateOperation);
No, you can't update an entity's PartitionKey
or RowKey
. What you would need to do is perform 2 operations: first delete the entity with existing PartitionKey/RowKey and then insert new entity with new PartitionKey/RowKey.