I have Stored procedure which Simply updates the Documents based on Etag.
i have fetched 3 types of documents, updated some property of all 3 documents. I'm trying to update all 3 documents in stored procedure. but the 3rd document is updated by another user before the stored procedure updates the 3rd documents. so in this scenario, I do get a concurrency error. I can fetch the Document inside the Stored procedure but I'm not sure which property I have to update because I don't know which property is get modified by me or by other users inside Stored procedure bcoz it just replaces the Documents. the same stored procedure used everywhere the documents need to update so I can't hardcode the property in it.
How can I handle this?
in entity framework code first approach, we do have a DbUpdateConcurrencyException class given for SQL from which we can see which property get modify and take the Action Accordingly. is there an exception class similar to the DbUpdateConcurrencyException is provided in Cosmos DB?
I do have readed DocumentDB revisited Part 3 – Concurrency in DocumentDB & DocumentDB – Optimistic Concurrency in a Stored Procedure both the articles.which tell us how to Use Etag to Handle Optimistic Concurrency.