在Azure表存储中更新RowKey或PartitionKey

我可以在Azure表存储中更新实体的RowKey或PartitionKey属性吗?

我想是或者可能只是PartitionKey但现在我正在尝试这样做(尝试更改RowKey或PartitionKey)并得到错误:

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() .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); 

不,您无法更新实体的PartitionKeyRowKey 。 您需要做的是执行2个操作:首先删除具有现有PartitionKey / RowKey的实体,然后使用新的PartitionKey / RowKey插入新实体。