Ah, thanks sergey.
So essentially I guess I can't take for granted that a transaction will be rolled back...
I think I'm going to make my Transaction object wrapper do an explicit rollback on dispose if it hasn't been rolled back or committed.
I'm trying to set up a nested transaction arragement where I can get the participants to subscribe to a "rolling back" event. If the main transaction or any nested transaction does a rollback, or the session or connection is closed/disposed while a transaction is in progress then I want to roll back the DB transaction (since, of course ADO.NET only actually allows one) and then raise the event.
I've set up an event helper to reverse the order in which the event handlers will fire so that the inner-most nested transaction participants will have their handler called first and each participant can use this handler clean up any non-db related resources they've used.
I think I've basically got it in the bag (unless there's something stupid I'm doing here that you can point out!), but it'd be much nicer if there were REAL nested transactions so you could just back out a sub-segment without having to kill the whole transaction from the top down.
Dumb idea?
Symon.
|