The connection was not being effectively closed due to

'NHibernate.ISession.Disconnect ()' contract:
        //
        // Summary:
        //     Disconnect the ISession from the current ADO.NET
connection.
        //
        // Returns:
        //     The connection provided by the application or null
        //
        // Remarks:
        //     If the connection was obtained by Hibernate, close it or
return it to the
        //     connection pool. Otherwise return it to the application.
This is used by
        //     applications which require long transactions.
This commit is contained in:
Hailton de Castro
2015-09-29 19:46:34 -03:00
parent cdfcc1d9a6
commit 4e39f3b220

View File

@@ -435,9 +435,13 @@ namespace Spring.Data.NHibernate.Support
conversation.RootSessionPerConversation = null;
}
else
{
if (tmpSession.IsConnected)
tmpSession.Disconnect();
{
if (tmpSession.IsConnected)
{
IDbConnection conn = tmpSession.Disconnect();
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
}
RemoveSession(tmpSession);
}