I have legacy dll which uses multiple NHibernate transactions in one method. My task is to make this method act as one transaction, so I think TransactionScope should help me. However, when I made something like this:
using (TransactionScope tx = new TransactionScope())
{
#region.. code inside dll
using (ISession session1 = ...)
using (ITransaction tx1 = session.BeginTransaction())
{
// ...do work with session
tx1.Commit();
}
using (ISession session2 = ...)
using (ITransaction tx2 = session.BeginTransaction())
{
// ...do work with session
tx2.Commit();
}
#endregion
tx.Complete();
}
...method is not rolledback if tx2 falls!
I would very much appreciate any suggestion or hint..
Thank you in advance