I need to be all my entire application transactional in its every web request it processes.
I need the transaction to start and, if there was no exceptions in controllers, commit it. Otherwise, rollback.
So far, I have the following implementation:
OnActionExecuted
method, where I either commit it or I don't.Here goes the list of technologies that I use:
Now, what I want to know is what about the deadlocks? What will happen when two web requests will be simultaneously processed, and besides they will acquire the right to work with two repositories (which are linked to the theirs DataContext
instances), and which means, two tables in the database?
For example: one request at first wants to read table Table1
and then Table2
, in meantime the other request wants to work with Table2
and then with Table1
.
What should I do?
Test concurrency handlingChange a field in the first browser tab and click Save. The browser shows the Index page with the changed value. Click Save again. The value you entered in the second browser tab is saved along with the original value of the data you changed in the first browser.
you can handle start and stop of transaction for call to DB please check this
How to prevent EntityFramework deadlock when concurrently running these two statements
hope this help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With