<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Managing your NHibernate Sessions</title>
	<atom:link href="http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Mon, 15 Mar 2010 08:03:58 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23154</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Fri, 11 Dec 2009 10:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23154</guid>
		<description>@Kurt

you&#039;re resolving your dependencies manually instead of having them injected... looking back on this post, i did the same thing in the example which i would no longer recommend

i&#039;ll write a new post with an example that hopefully makes this clear... it&#039;ll be based on the NhRequestHandler that you&#039;ve already seen in another post though ;)</description>
		<content:encoded><![CDATA[<p>@Kurt</p>
<p>you&#8217;re resolving your dependencies manually instead of having them injected&#8230; looking back on this post, i did the same thing in the example which i would no longer recommend</p>
<p>i&#8217;ll write a new post with an example that hopefully makes this clear&#8230; it&#8217;ll be based on the NhRequestHandler that you&#8217;ve already seen in another post though <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kurt schroeder</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23153</link>
		<dc:creator>kurt schroeder</dc:creator>
		<pubDate>Thu, 10 Dec 2009 22:43:16 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23153</guid>
		<description>yes i suppose that would help to know that. You&#039;d figure i&#039;d realize specifics are a bit important having worked a tech line at one point. Your patience on that one is appreciated. 
Bear in mind that i&#039;m new to NH and may make some obvious mistakes. I can manage session, drawing upon a friends advise, in command objects by just ending the session with close. I&#039;m making all execute methods return an IResponse to be cast as the correct type. In this case a void would work, but for consistancy it will return an EmptyResponse(). In the case of a Collection, List, ... IResponse would be implimented a List, collection, ... I did not come up with that idea and don&#039;t want to take credit for thinking of it. 

        public IResponse Execute()
        {
            var sessionProvider = IoC.Container.Resolve();
            var junkRepository = IoC.Container.Resolve();
            sessionProvider.StartSession();
            junkRepository.Save(junk);
            sessionProvider.EndSession();
            return new EmptyResponse();
        }

In the repositories I&#039;m hoping that i can do something similar. 

        public IEnumerable GetJunk()
        {
            var sessionProvider = IoC.Container.Resolve();
            var queryString = &quot;select j from Junk j&quot;;
            var query = sessionProvider.GetCurrentSession().CreateQuery(queryString);
            query.SetResultTransformer(new DistinctRootEntityResultTransformer());
            return query.List();
        }

The obvious problem i&#039;m having when i do this is the session not being handled correctly. Am I off base by using this at all in the repository and should just stick with command objects? 
I&#039;m guessing this is where the UnitofWork could come in, but i&#039;m a little fuzzy on how to do this.

I&#039;m up for an example because i have a lot of questions like this and others.</description>
		<content:encoded><![CDATA[<p>yes i suppose that would help to know that. You&#8217;d figure i&#8217;d realize specifics are a bit important having worked a tech line at one point. Your patience on that one is appreciated.<br />
Bear in mind that i&#8217;m new to NH and may make some obvious mistakes. I can manage session, drawing upon a friends advise, in command objects by just ending the session with close. I&#8217;m making all execute methods return an IResponse to be cast as the correct type. In this case a void would work, but for consistancy it will return an EmptyResponse(). In the case of a Collection, List, &#8230; IResponse would be implimented a List, collection, &#8230; I did not come up with that idea and don&#8217;t want to take credit for thinking of it. </p>
<p>        public IResponse Execute()<br />
        {<br />
            var sessionProvider = IoC.Container.Resolve();<br />
            var junkRepository = IoC.Container.Resolve();<br />
            sessionProvider.StartSession();<br />
            junkRepository.Save(junk);<br />
            sessionProvider.EndSession();<br />
            return new EmptyResponse();<br />
        }</p>
<p>In the repositories I&#8217;m hoping that i can do something similar. </p>
<p>        public IEnumerable GetJunk()<br />
        {<br />
            var sessionProvider = IoC.Container.Resolve();<br />
            var queryString = &#8220;select j from Junk j&#8221;;<br />
            var query = sessionProvider.GetCurrentSession().CreateQuery(queryString);<br />
            query.SetResultTransformer(new DistinctRootEntityResultTransformer());<br />
            return query.List();<br />
        }</p>
<p>The obvious problem i&#8217;m having when i do this is the session not being handled correctly. Am I off base by using this at all in the repository and should just stick with command objects?<br />
I&#8217;m guessing this is where the UnitofWork could come in, but i&#8217;m a little fuzzy on how to do this.</p>
<p>I&#8217;m up for an example because i have a lot of questions like this and others.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23152</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 10 Dec 2009 21:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23152</guid>
		<description>@kurt

what kind of example do you want?</description>
		<content:encoded><![CDATA[<p>@kurt</p>
<p>what kind of example do you want?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kurt schroeder</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23151</link>
		<dc:creator>kurt schroeder</dc:creator>
		<pubDate>Thu, 10 Dec 2009 21:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23151</guid>
		<description>I have to say thanks, not just for this article, but for all the others. I noticed a request for an example just curious if you ever got around to one. I&#039;m still a bit new to NHibernate and DI, IoC, .. I get unsure of what should go where. These articles have helped a lot.</description>
		<content:encoded><![CDATA[<p>I have to say thanks, not just for this article, but for all the others. I noticed a request for an example just curious if you ever got around to one. I&#8217;m still a bit new to NHibernate and DI, IoC, .. I get unsure of what should go where. These articles have helped a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23114</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23114</guid>
		<description>I almost never resolve components manually

Agatha resolves the request handler for the current request, and that request handler simply declares all the dependencies that it needs to handle the request.  Agatha automatically releases the resolved request handler, and the request handler disposes of its dependencies</description>
		<content:encoded><![CDATA[<p>I almost never resolve components manually</p>
<p>Agatha resolves the request handler for the current request, and that request handler simply declares all the dependencies that it needs to handle the request.  Agatha automatically releases the resolved request handler, and the request handler disposes of its dependencies</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten Jacobsen</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-23113</link>
		<dc:creator>Morten Jacobsen</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:04:04 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-23113</guid>
		<description>Great post.. I am learning a lot about keeping code loosely coupled.. I have a question though.. How would you do it if you had to insert or update the values instead of reading them? Would you do something akin to the following?

public void InsertCategory(ProductCategoryDTO dto)
{
   using(var uow = Container.Resolve())
   {
      using (ITransaction transaction = uow.CreateTransaction())
      {
         try
         {
            var pc = CreateProductCategoryFromDto(dto);
            var repository = Container.Resolve();
            repository.SaveOrUpdate(pc);
            transaction.Commit();   
         }
         catch(SomeException e)
         {
            transaction.Rollback();
         }
      }
   }
}

Or do you have a better/more elegant way?

Thanks in advance,
Morten Jacobsen</description>
		<content:encoded><![CDATA[<p>Great post.. I am learning a lot about keeping code loosely coupled.. I have a question though.. How would you do it if you had to insert or update the values instead of reading them? Would you do something akin to the following?</p>
<p>public void InsertCategory(ProductCategoryDTO dto)<br />
{<br />
   using(var uow = Container.Resolve())<br />
   {<br />
      using (ITransaction transaction = uow.CreateTransaction())<br />
      {<br />
         try<br />
         {<br />
            var pc = CreateProductCategoryFromDto(dto);<br />
            var repository = Container.Resolve();<br />
            repository.SaveOrUpdate(pc);<br />
            transaction.Commit();<br />
         }<br />
         catch(SomeException e)<br />
         {<br />
            transaction.Rollback();<br />
         }<br />
      }<br />
   }<br />
}</p>
<p>Or do you have a better/more elegant way?</p>
<p>Thanks in advance,<br />
Morten Jacobsen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lemycanh</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-21552</link>
		<dc:creator>lemycanh</dc:creator>
		<pubDate>Wed, 01 Jul 2009 17:26:45 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-21552</guid>
		<description>I had google and google... nhibernate session management for winform, finaly, i found your article, this&#039;s a great article, thanks alot!
(sorry for my poor english :D)</description>
		<content:encoded><![CDATA[<p>I had google and google&#8230; nhibernate session management for winform, finaly, i found your article, this&#8217;s a great article, thanks alot!<br />
(sorry for my poor english <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Mckay</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-16815</link>
		<dc:creator>Ian Mckay</dc:creator>
		<pubDate>Mon, 25 May 2009 19:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-16815</guid>
		<description>Hi,

I have found this article extremely useful. I just thought I&#039;d share one minor change I made. When injecting the IUnitOfWork from my controller, the session was being started even if my action was not using the database (because the constructor was being fired). It was then throwing an error on the next action to use the UoW because the previous session hadn&#039;t been disposed. I added an extra method to the IUnitOfWork:

    public interface IUnitOfWork : IDisposable
    {
        ..
        /// 
        /// Starts the Unit of Work
        /// 
        /// Itself
        IUnitOfWork Start();
    }

And moved the setActiveSession logic out of the constructor and into this method. Because it returns itself it can still be used in the using block.

    using (unitOfWork.Start())(

Again, many thanks for the article. Keep up the good work. :)</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have found this article extremely useful. I just thought I&#8217;d share one minor change I made. When injecting the IUnitOfWork from my controller, the session was being started even if my action was not using the database (because the constructor was being fired). It was then throwing an error on the next action to use the UoW because the previous session hadn&#8217;t been disposed. I added an extra method to the IUnitOfWork:</p>
<p>    public interface IUnitOfWork : IDisposable<br />
    {<br />
        ..<br />
        ///<br />
        /// Starts the Unit of Work<br />
        ///<br />
        /// Itself<br />
        IUnitOfWork Start();<br />
    }</p>
<p>And moved the setActiveSession logic out of the constructor and into this method. Because it returns itself it can still be used in the using block.</p>
<p>    using (unitOfWork.Start())(</p>
<p>Again, many thanks for the article. Keep up the good work. <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-16720</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Mon, 25 May 2009 05:07:55 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-16720</guid>
		<description>@Ian

that service layer implementation is just some example code... in my real service layer, the IUnitOfWork instance is indeed injected instead of resolved manually</description>
		<content:encoded><![CDATA[<p>@Ian</p>
<p>that service layer implementation is just some example code&#8230; in my real service layer, the IUnitOfWork instance is indeed injected instead of resolved manually</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Mckay</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-16650</link>
		<dc:creator>Ian Mckay</dc:creator>
		<pubDate>Sun, 24 May 2009 20:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-16650</guid>
		<description>Hi,

A quick question regarding your implementation of the service layer. Doesn&#039;t the explicit call to IoC container, Container.Resolve()
limit your testability. It would seem to make sense to pass in the UoW on the constructor. 

How do you test this?

I like the use of the using statement however the only disadvantage I could see is if you wanted to chain service method calls. With each method call the UoW would dispose of the Session.

Thanks,</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>A quick question regarding your implementation of the service layer. Doesn&#8217;t the explicit call to IoC container, Container.Resolve()<br />
limit your testability. It would seem to make sense to pass in the UoW on the constructor. </p>
<p>How do you test this?</p>
<p>I like the use of the using statement however the only disadvantage I could see is if you wanted to chain service method calls. With each method call the UoW would dispose of the Session.</p>
<p>Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor Westerdahl</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10854</link>
		<dc:creator>Trevor Westerdahl</dc:creator>
		<pubDate>Tue, 31 Mar 2009 02:48:57 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10854</guid>
		<description>Arg! No example?

I would love to see one simple example... how does one persuade you?</description>
		<content:encoded><![CDATA[<p>Arg! No example?</p>
<p>I would love to see one simple example&#8230; how does one persuade you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10522</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 25 Mar 2009 19:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10522</guid>
		<description>Not one that i can just give out right now, sorry</description>
		<content:encoded><![CDATA[<p>Not one that i can just give out right now, sorry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris-I</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10521</link>
		<dc:creator>Kris-I</dc:creator>
		<pubDate>Wed, 25 Mar 2009 19:15:59 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10521</guid>
		<description>Hello,

You don&#039;t have a full example of this ? Thanks</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>You don&#8217;t have a full example of this ? Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10105</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Thu, 19 Mar 2009 10:15:10 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10105</guid>
		<description>Davy - 

Thanks! I think that is steering me in the right direction. I am trying to learn how to apply several patterns (IOC, DI, etc) all at once while learning a new ORM AND trying to do it all in the web. This learning seems steep.

C</description>
		<content:encoded><![CDATA[<p>Davy &#8211; </p>
<p>Thanks! I think that is steering me in the right direction. I am trying to learn how to apply several patterns (IOC, DI, etc) all at once while learning a new ORM AND trying to do it all in the web. This learning seems steep.</p>
<p>C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10098</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 19 Mar 2009 07:01:55 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10098</guid>
		<description>i&#039;m not sure if i understand what exactly it is that you&#039;re asking but i&#039;ll give it a shot anyways:

every class that needs request-scoped state would talk to something that implements IRequestState, but they would never know the specific type of the actual implementation. So, if you have another assembly which contains only your businesslayer (and no reference to System.Web), then you should have classes which need request-state depend on an IRequestState instance.

At runtime, the container will inject AspNetRequestState into each class which has a dependency on IRequestState, but none of those classes will even know that they are talking with AspNetRequestState.  Since the business assembly is running within the ASP.NET context, your AspNetRequestState can do anything it wants with the current HttpContext.  Or, if the business assembly is running in a different context (in a WCF service for instance) then the container would be configured to inject WcfRequestState.  None of the classes that need request-state would know anything about either AspNetRequestState or WcfRequestState though... they just know IRequestState

Hope that answers your question :)</description>
		<content:encoded><![CDATA[<p>i&#8217;m not sure if i understand what exactly it is that you&#8217;re asking but i&#8217;ll give it a shot anyways:</p>
<p>every class that needs request-scoped state would talk to something that implements IRequestState, but they would never know the specific type of the actual implementation. So, if you have another assembly which contains only your businesslayer (and no reference to System.Web), then you should have classes which need request-state depend on an IRequestState instance.</p>
<p>At runtime, the container will inject AspNetRequestState into each class which has a dependency on IRequestState, but none of those classes will even know that they are talking with AspNetRequestState.  Since the business assembly is running within the ASP.NET context, your AspNetRequestState can do anything it wants with the current HttpContext.  Or, if the business assembly is running in a different context (in a WCF service for instance) then the container would be configured to inject WcfRequestState.  None of the classes that need request-state would know anything about either AspNetRequestState or WcfRequestState though&#8230; they just know IRequestState</p>
<p>Hope that answers your question <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10084</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Wed, 18 Mar 2009 21:54:37 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10084</guid>
		<description>Davy - 

I was trying to write a small Web App to try and put all of these pieces together. I have also implemented the ActiveSessionManager to use the IRequestState which I would pass in AspNetRequestState in the Constructor.

So here is where I am getting lost.

I am assuming that the &quot;GetAllProductCategories&quot; method (last bit of code in the post) would be in a seperate assembly from the web application. 

If the IOC Container is Resolving the UnitOfWork, but, it is not in the web application, how will the AspNetRequestState be able to pull the Nhibernate Session out of HTTPContext?

Thanks

Chuck</description>
		<content:encoded><![CDATA[<p>Davy &#8211; </p>
<p>I was trying to write a small Web App to try and put all of these pieces together. I have also implemented the ActiveSessionManager to use the IRequestState which I would pass in AspNetRequestState in the Constructor.</p>
<p>So here is where I am getting lost.</p>
<p>I am assuming that the &#8220;GetAllProductCategories&#8221; method (last bit of code in the post) would be in a seperate assembly from the web application. </p>
<p>If the IOC Container is Resolving the UnitOfWork, but, it is not in the web application, how will the AspNetRequestState be able to pull the Nhibernate Session out of HTTPContext?</p>
<p>Thanks</p>
<p>Chuck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10037</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Tue, 17 Mar 2009 21:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10037</guid>
		<description>thanks :)</description>
		<content:encoded><![CDATA[<p>thanks <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10036</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Tue, 17 Mar 2009 21:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10036</guid>
		<description>Davy - 

I was just coming on to post that I had found your source code on the site. Again, between you and Steve B. I have learned sooo much about NHibernate.

Cheers.

C</description>
		<content:encoded><![CDATA[<p>Davy &#8211; </p>
<p>I was just coming on to post that I had found your source code on the site. Again, between you and Steve B. I have learned sooo much about NHibernate.</p>
<p>Cheers.</p>
<p>C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10031</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Tue, 17 Mar 2009 20:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10031</guid>
		<description>yeah sorry about that, one of the very first versions of the Disposable class had the ClearReferences method.  I&#039;ve since updated the original post... the Disposable class now looks like this:

http://davybrion.com/blog/2008/06/disposing-of-the-idisposable-implementation/

The ClearReferences method as used in this post has been replaced by the DisposeUnmanagedResources method, though they don&#039;t have the same purpose.  The ClearReferences method was basically a mistake :)

Umm, but to make a long answer short: it was also called in Dispose :)</description>
		<content:encoded><![CDATA[<p>yeah sorry about that, one of the very first versions of the Disposable class had the ClearReferences method.  I&#8217;ve since updated the original post&#8230; the Disposable class now looks like this:</p>
<p><a href="http://davybrion.com/blog/2008/06/disposing-of-the-idisposable-implementation/" rel="nofollow">http://davybrion.com/blog/2008/06/disposing-of-the-idisposable-implementation/</a></p>
<p>The ClearReferences method as used in this post has been replaced by the DisposeUnmanagedResources method, though they don&#8217;t have the same purpose.  The ClearReferences method was basically a mistake <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Umm, but to make a long answer short: it was also called in Dispose <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/comment-page-1/#comment-10029</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Tue, 17 Mar 2009 19:59:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=149#comment-10029</guid>
		<description>Davy - 

Thanks! This is really putting together some pieces that I was missing while working with NHibernate. Just a quick question, I could not find on your site the implementation of Disposable that calls the ClearReferences() method. At what point in Disposable does that get called?

Chuck</description>
		<content:encoded><![CDATA[<p>Davy &#8211; </p>
<p>Thanks! This is really putting together some pieces that I was missing while working with NHibernate. Just a quick question, I could not find on your site the implementation of Disposable that calls the ClearReferences() method. At what point in Disposable does that get called?</p>
<p>Chuck</p>
]]></content:encoded>
	</item>
</channel>
</rss>
