I am implementing an optimistic concurrency with DocumentDb API using .NET SDK.
On several places i have found mentioning that having ETag on strongly typed model is a bad idea.
Explicitly here:
https://www.google.hr/amp/s/peter.intheazuresky.com/2016/04/28/documentdb-revisited-part-3-concurrency-in-documentdb/amp/
Even official examples on github show it using dynamic/Document classes instead of strongly typed ones.
Now, what i dont understand is why not storing ETag on model?
According to docs, ETag, just like other resource properties (exception is id) is get only and is always changed exclusively by the server.
Ref:
https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-resources#system-vs-user-defined-resources
So, if we put ETag on our model and:
read document from db to strongly typed model with
etagpropertysend it to client (lets ignore for simplicity presentation layer
dtos)client updates it and send back
we send update/replace to cosmosdb (with
AccessConditionset toetaggotten from client and still in one of the models properties)
I have a hard time finding a problem there?
Why bothering with dynamics/Document at all?
Or am i missing something obvious?