eTag in Cosmos Db How to solve concurrency with practical example

This is the best practical example to understand what is eTag in cosmos db and How to solve concurrency we have explained with practical example. In First 2 minutes we have explained what is eTag and what is Concurrency Problem in real world.

After that in next 6 minutes we have created the practical example and reproduced the Concurrency problem in cosmos db by creating multiple dummy instances.

And then at last we have seen how we can easily resolve Concurrency problem in cosmos db using eTag Property.

We just have to use RequestOptions - AccessCondition Object to enable etag.
 

  var requestOptions = new RequestOptions
                {
                    AccessCondition = new AccessCondition
                    {
                        Condition = userInfo._etag,
                        Type = AccessConditionType.IfMatch
                    }
                };

 

CP Variyani

http://codingfriday.com

He is a Full Stack Web Developer with almost 8 years of professional experience. Learn more and connect with him on Facebook, Instagram, LinkedIn.

Scroll to Top