Then, what is a good way to see whether the connection is really
closed ?
Even if I want to detach my DB (while the session is still open, but
the transaction has been committed), I see that there is still an
active connection to the DB.

I'm sorry that I am a bit ... persistent ... Fabio, but I really want
to see it with my own eyes. :)

When I explicitly disable connection pooling, I can indeed see that
the number of connections to my DB decreases.  (I've checked the
performance counters).
When I do not disable pooling, I do not see the number of connections
decrease.


On 7 nov, 17:35, "Sean Carpenter" <[EMAIL PROTECTED]> wrote:
> sp_who can't be used to check if the connection is still open since ADO.Net
> connection pooling will actually keep the underlying connection open even
> after it is closed from user code.  You can trust that it's available to be
> used by a different Session, so it is "closed" from the application's point
> of view.
> Sean Carpenter
>
> On Fri, Nov 7, 2008 at 10:59 AM, 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