2

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?

Woody1193
  • 7,252
  • 5
  • 40
  • 90

1 Answers1

0

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/

Sairam Tadepalli
  • 1,563
  • 1
  • 3
  • 11
  • Except I'm working in C#. – Woody1193 Jun 01 '22 at 23:16
  • Kindly check the updated answer. – Sairam Tadepalli Jun 02 '22 at 03:29
  • This still doesn't answer my question. Nor does it offer an example of how I would make this work. The author in the blog you provided gives an extremely high-level discussion of the actual problem, but I'm looking for a more detailed explanation here. – Woody1193 Jun 02 '22 at 08:09
  • Sorry for my earlier response. I let my frustration get the better of me. My issue, specifically, is that I don't understand how I'm supposed to work with ETags. I can't leave it blank because I'll get a conflict. But, apparently I can't use the same value as when I got the item as that will also generate a conflict. So, I'm not sure which value I'm supposed to use. – Woody1193 Jun 07 '22 at 00:20
  • Kindly check the below link to get the sample code block by @imrn https://stackoverflow.com/questions/17441379/what-is-purpose-of-etag-in-itableentity Unfortunatly, there is no complete documentation on your requirement – Sairam Tadepalli Jun 07 '22 at 03:25
  • Looks like my question was a duplicate but that link provides the answer I was looking for. – Woody1193 Jun 07 '22 at 04:03