How to enable concurrency checking using EF 5.0 Code First?
问题 I would like to do a check-then-update in an atomic operation. I am using dbcontext to manage the transaction. I was expecting to get an exception if the record has been modified by another thread but no exception is thrown. Any help would be appreciated. Here's my output: Thread-4: Reading... Thread-5: Reading... Thread-5: Updating destination 1 Thread-4: Updating destination 1 Thread-4: SaveChanges Thread-5: SaveChanges Here's my code snippet: public static void Main(string[] args) {