Hi i am working on azure table "T1" and this table have list of entity set
Primarykey RowKey P1 P2
PP R1 5 10
PP R2 6 11
now suppose i want to update only P2 property and don't want to touch P1 property is this possibly to update single property in azure table entity. Remember i don't want to touch P1 property cos it continuously updating by other function
The operation you would want to perform is Merge Entity
. From the REST API documentation:
The Merge Entity operation updates an existing entity by updating the entity's properties. This operation does not replace the existing entity, as the Update Entity operation does.
Here's a sample code that you can use:
static void MergeEntityExample()
{
var cred = new StorageCredentials(accountName, accountKey);
var account = new CloudStorageAccount(cred, true);
var client = account.CreateCloudTableClient();
var table = client.GetTableReference("TableName");
var entity = new DynamicTableEntity("PartitionKey", "RowKey");
entity.ETag = "*";
entity.Properties.Add("P2", new EntityProperty(12));
var mergeOperation = TableOperation.Merge(entity);
table.Execute(mergeOperation);
}
The above code will only update "P2" property in the entity and will not touch other properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With