I've been struggling to get multiple sessions to work within the same transaction. I've created an architecture based on this article
http://codebetter.com/blogs/karlseguin/ ... bases.aspx that has two SessionFactories (for two DBs) and two sessions.
I have written a number of unit tests that work (read from two DBs, edit one and then the other, etc), but as soon as I try to wrap any of them in a TransactionScope it fails. As soon as I try to access the second session, I get one of a number of issues.
-If I look at the session in the debugger, it seems corrupt saying "Function Evaluation Timed Out"
-If I let it time out, I get "System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed" for 2.0.1 or "System.Transactions.TransactionException: The operation is not valid for the state of the transaction for NHibernate 2.1.
It seems like looking at the first session, throws the second session into a weird state. I've tried re-creating the session, disconnecting, etc. but nothing seems to work.
Is there no way to get two sessions to work within the same transaction? I really want to make sure that the data stays consistent across the two DBs.