The problem is that configuring the connection.release_mode does not
work. As soon as you have a transaction context, the closing of the
session is done in the Transaction_Completed event handler.
Dispose(true) (which closes the session and the connection) is never
called.
See my example from above:
SessionImpl.cs:
public void Dispose()
{
using (new
SessionIdLoggingContext(SessionId))
{
log.Debug(string.Format("[session-
id={0}] running
ISession.Dispose()", SessionId));
if (TransactionContext!=null)
{
TransactionContext.ShouldCloseSessionOnDistributedTransactionCompleted
= true;
return;
}
Dispose(true);
}
}
TransactionContext is not null and therefore the connection won't be
close no matter what you've configured in the settings. The
ConnectionManager used internally by NHibernate also has a
precondition that prevents closing a session while being in a
transaction.
This can't be correct, right? Or maybe I still haven't understand how
should work.
On 27 Sep., 17:17, Jason Meckley <[email protected]> wrote:
> how long are you keeping the TX open that scoping the connection to the TX
> is a problem? you can configure connection management by setting
> connection.release_mode<http://nhforge.org/doc/nh/en/index.html#transactions-connection-release>
--
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.