Hi,
inspired by the auditing example from NHibernate in Action book, I'm
opening a new session in an EventListener with the current
DbConnection like this:
public bool OnPreUpdate(PreUpdateEvent args)
{
using (var session=args.Persister.Factory.OpenSession
(args.Source.Connection))
{
//save new log entry here
session.Flush();
}
return false;
}
which results in an exception on session.Flush():
"ExecuteNonQuery requires the command to have a transaction when the
connection assigned to the command is in a pending local transaction.
The Transaction property of the command has not been initialized."
Seems like the transaction of the "outer session" is not used by the
"inner session". If I create a command manually and enlist it in the
transaction, it works.
I'm not sure if this behaviour is changed by intention or if it's a
bug.
Any hints for me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
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
-~----------~----~----~----~------~----~------~--~---