The first problem I see is nested transactions. don't nest them. you only
need one. if you are using a system transaction then instantiate the
transaction before you open the session
using(var tx = new TransactionScope())
using(var session = factory.OpenSession()
{
do work
tx.Complete();
}
if you are using NH 3.x that's all you need. if you are using NH 2.x you
still need to manage the NH transaction to prevent a memory leak when a
system transaction does not complete.
However, since you don't need distributed transactions, I would drop the
system transaction all together and stick with NH transaction
using(var session = factory.OpenSession())
using(var tx = session.BeginTransaction
try
{
do work
tx.Commit();
}
catch
{
tx.Rollback();
throw;
}
Again, do not nest transactions.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/u38joyRUiUoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.