What would I need to do in my dataset C# client for handling optimistic concurrency?
This article does not go into many details except from use a timestamp
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s not really correct, the article just mentions timestamps (the use case in the first half or the article), and alternatively provides more details on the second optimistic lock implementation –
The magic is performed by the following statement:
So you’d just listen to
RowUpdatedevent, and ifRecordsAffectedis zero then something bad happened.Timestamp-based implementation is pretty obvious as well. You’ll have a datetime along with your dataset:
For updating you’ll have two ways – explicit, when you check timestamps even before attempting to save anything:
Or implicit, like the second way described in the article – try update using timestamp as a condition:
and if zero rows are updated then you’ll know about concurrency exception and report correspondingly.