Hi,
how can we handle concurrency concerning database operations within the application safe and easily? We need to detect that two or more users are changing the same datasets and warn them.
3 Answer(s)
-
0
Related topic: #4146@6c148c17-0f2f-42c9-a386-dd70810dd348
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Not sure why they referenced that previous forum post. This is very easy to do in EF.
<a class="postlink" href="http://www.learnentityframeworkcore.com/configuration/data-annotation-attributes/concurrencycheck-attribute">http://www.learnentityframeworkcore.com ... -attribute</a>
Add the [ConcurrencyCheck] attribute to the fields you want to be auto added to the where clause.
So instead of update x set x.name = Person1 where x.id = 1 it would be update x set x.name = Person1 where where x.id = 1 and x.name = PersonA
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
No need for the hostility. I referenced that topic because it's directly related and it offers solutions to a few potential issues.
Using the [ConcurrencyCheck] attribute means you cannot modify those values. A RowVersion property is the way to go.
A better link would be: <a class="postlink" href="http://www.learnentityframeworkcore.com/concurrency">http://www.learnentityframeworkcore.com/concurrency</a>
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)