How to handle request-wise DB transactions in ASP.NET MVC?
Posted
by Dario Solera
on Stack Overflow
See other posts from Stack Overflow
or by Dario Solera
Published on 2010-04-01T07:20:15Z
Indexed on
2010/04/01
7:23 UTC
Read the original article
Hit count: 341
I'm using SubSonic 3.0 (SimpleRepository) to handle database access in my ASP.NET MVC 1.0 application.
It would be nice to handle a transaction for every web request, committing if everything went smooth and rolling back in case of exception. Is this possible? If so, how?
I know this topic has been discussed many times, but I just couldn't find a satisfactory answer. I have built my own solution (create a TransactionScope in the controller, then commit/rollback in OnActionExecuted), but it turns out to be very unreliable.
© Stack Overflow or respective owner