My Data
ID VALUE
1 100
I'm using EFCore and Postgresql. I have 2 requests update a record with Id =1
in the same time.
- Request 1: Get record
Id = 1
, recieve{Id =1, Value=100}
, then I updateValue = Value + 10
and update to DB - Request 2: When Request 1 don't finish update, Get record
Id = 1
, recieve{Id = 1, Value = 100}
, then I updateValue = Value + 20
and update to DB
Finnaly, In DB have {Id =1, Value= 120}
. I expected {Id =1, Value= 130}
.
I want when client 2 get data, it must waiting for client finish update that record with new data.
Or when client 2 update data, how can I check data different on DB before Update
Sorry about my English, Thanks for help!