Hmm, but in NHibernate source I indeed see that the connection is
closed.

if (IsAfterTransactionRelease)
                        {
                                AggressiveRelease();
                        }
                        else if (IsAggressiveRelease && 
batcher.HasOpenResources)
                        {
                                log.Info("forcing batcher resource cleanup on 
transaction
completion; forgot to close ScrollableResults/Enumerable?");
                                batcher.CloseCommands();
                                AggressiveRelease();
                        }
                        else if (IsOnCloseRelease)
                        {
                                // log a message about potential connection 
leaks
                                log.Debug(
                                        "transaction completed on session with 
on_close connection
release mode; be sure to close the session to release ADO.Net
resources!");
                        }
                        transaction = null;

where AggressiveRelease closes the connection ...

So, allow me to be a bit confused here.

On 7 nov, 16:59, FrederikGheysels <[EMAIL PROTECTED]>
wrote:
> On 7 nov, 16:36, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
>
> > 2008/11/7 FrederikGheysels <[EMAIL PROTECTED]>
>
> > > I expect that the Session is disconnected after the Commit
> > > Transaction, but it is not.  The Session is still connected.
>
> > Trust us ;)
> > and don't worry about it.
>
> > --
> > Fabio Maulo
>
> Please allow me to be a bit critical :)
>
> When Ayende says that NH maintains the abstraction that the session
> always has an open connection, then this also implies that the
> IsConnected property of the ISession should always return true.
> (Then, I wonder: what's the use of this property ) ?
>
> I've also done a little test:
>
>             using( UnitOfWork uow =
> UnitOfWorkFactory.Instance.CreateUnitOfWork () )
>             {
>                 ISession s = uow.Session;
>
>                 Assert.IsTrue (s.IsOpen, "Session is expected to be
> open");
>                 Assert.IsTrue (s.IsConnected, "Session is expected to
> be connected");
>                 Assert.AreEqual
> (s.SessionFactory.Settings.ConnectionReleaseMode,
> ConnectionReleaseMode.AfterTransaction,
>                                  "ConnectionReleaseMode is expected to
> be AfterTransaction");
>                 Assert.AreEqual (s.FlushMode, FlushMode.Auto,
> "FlushMode must be Auto");
>
>                 ITransaction tx = s.BeginTransaction
> ();
>
>                 tx.Commit ();
>
>                 Assert.IsFalse (s.IsConnected, "Session should be
> disconnected");
>             }
>
> This test fails on the last Assert.
> I've also checked the number of connections using the SQL Server
> sp_who SP.
> From the results of this SP, I learn that the connection to my DB is
> kept open when the Transaction has been committed ...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to