Add or replace entity in Azure Table Storage

后端 未结 5 478
攒了一身酷
攒了一身酷 2021-01-07 23:41

I\'m working with Windows Azure Table Storage and have a simple requirement: add a new row, overwriting any existing row with that PartitionKey/RowKey. However, saving the c

5条回答
  •  时光说笑
    2021-01-08 00:32

    In order to operate on an existing object NOT managed by the TableContext with either Delete or SaveChanges with ReplaceOnUpdate options, you need to call AttachTo and attach the object to the TableContext, instead of calling AddObject which instructs TableContext to attempt to insert it.

    http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.attachto.aspx

提交回复
热议问题