Session.Close vs Session.Dispose in NH 2.1

Description

Hi,

we're using Burrow in our project and recently we had to upgrade to
NHibernate 2.1 because it added functionality we really needed.
Everything went (semi-)smooth until all the pieces came together. Let
me explain our situation:

We use manual transaction management, because we need to use
Transactionscopes (which is now properly supported in NHibernate). In
certain conditions, we got the following error: "Disconnect cannot be
called while a transaction is in progress."

A little google search revealed that this exception is triggered by
calling session.Close() instead of session.Dispose() to end a session
when using Transactionscopes.

The following patch implements this change in Burrow:

Index: SessionAndTransactionManager.cs
===================================================================
— SessionAndTransactionManager.cs (revision 935)
+++ SessionAndTransactionManager.cs (working copy)
@@ -68,7 +68,7 @@
return;

if (session.IsOpen)

  • session.Close();
    + session.Dispose();
    session = null;
    }

Cheers,
Lodewijk

Environment

None

Attachments

1

Activity

Show:

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created July 13, 2009 at 1:06 AM
Updated July 13, 2009 at 1:06 AM
Loading...