Hello,
My task requires to incrementally update value in the database. Using plain SQL I will do something like this:
Of course we can use traditional way but the problem come up when multiple users needs to increment value. I have read about concurrency model in EF and obviously it is good when concurrency is low (i.e. very few concurrent updates). When concurrency is high, this method produce huge overhead by constant re-reading actual values from the DB. I'm looking for a way to force EF generate statement like I wrote above and put concurrency problem on the DB server which was designed to deal with it. I've also researched the ability to write custom extention for EF, but didn't find a good example of such extention or any information how to create it.
Any ideas?
Best regards,
Pavel
My task requires to incrementally update value in the database. Using plain SQL I will do something like this:
update Table
set Amount=Amount+:Delta
where ID=123
It is possible to do this using EF ? Of course we can use traditional way but the problem come up when multiple users needs to increment value. I have read about concurrency model in EF and obviously it is good when concurrency is low (i.e. very few concurrent updates). When concurrency is high, this method produce huge overhead by constant re-reading actual values from the DB. I'm looking for a way to force EF generate statement like I wrote above and put concurrency problem on the DB server which was designed to deal with it. I've also researched the ability to write custom extention for EF, but didn't find a good example of such extention or any information how to create it.
Any ideas?
Best regards,
Pavel