Woody1193
Woody1193

Reputation: 7980

How to use ETag in Azure Table Store

This has been confusing me for awhile. According to Microsoft's documentation, the Azure Table Store uses the ETag to maintain optimistic concurrency. To my understanding, when I do this:

var operation = TableOperation.Merge(item);
CloudTable table = Client.GetTableReference(TableName);
await table.CreateIfNotExistsAsync().ConfigureAwait(false);
TableResult result = await table.ExecuteAsync(operation, token).ConfigureAwait(false);

the ETag field should be updated and returned with the table result. However, I don't see this field update when I test locally. According to the documentation, I can override it by setting ETag = "*" but this defeats the purpose of using the ETag system if I do it with every update operation. So then, how can I use this field properly to ensure that out-of-date entities do not overwrite newer data?

Upvotes: 2

Views: 2482

Answers (1)

Sairam Tadepalli
Sairam Tadepalli

Reputation: 1683

ETag is not specifically for the TimeStamp. To record the TimeStamp we would have other different properties. The ETag used only for the concurrency.

Check out this official blog on the similar work.

https://www.michaelcrump.net/azure-tips-and-tricks88/

Upvotes: 0

Related Questions