<?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: The Importance Of Releasing Your Components Through Windsor</title>
	<atom:link href="http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Tue, 09 Mar 2010 16:27:57 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Krzysztof Koźmic</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-26346</link>
		<dc:creator>Krzysztof Koźmic</dc:creator>
		<pubDate>Wed, 27 Jan 2010 08:38:59 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-26346</guid>
		<description>Davy,

I would like to bring this to your attention, that the behavior you&#039;re describing was actually a bug, and it is fixed in current version (v2.1)
Since your post is pretty high in search engines, I think it might beneficial to put a notification about it on top of the post, to avoid confusing people seeking information about how that works in current version.</description>
		<content:encoded><![CDATA[<p>Davy,</p>
<p>I would like to bring this to your attention, that the behavior you&#8217;re describing was actually a bug, and it is fixed in current version (v2.1)<br />
Since your post is pretty high in search engines, I think it might beneficial to put a notification about it on top of the post, to avoid confusing people seeking information about how that works in current version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-23112</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:01:20 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-23112</guid>
		<description>That example would indeed cause a problem with the resolved IUnitOfWork instance not being released through the container

In our code at work, that&#039;s not a problem because we never resolve the IUnitOfWork directly, and it&#039;s always used as a dependency of a resolved component (a Request Handler).  That resolved component is always released through the container.

You can also avoid the problem like this:
http://davybrion.com/blog/2008/12/the-resolvable/</description>
		<content:encoded><![CDATA[<p>That example would indeed cause a problem with the resolved IUnitOfWork instance not being released through the container</p>
<p>In our code at work, that&#8217;s not a problem because we never resolve the IUnitOfWork directly, and it&#8217;s always used as a dependency of a resolved component (a Request Handler).  That resolved component is always released through the container.</p>
<p>You can also avoid the problem like this:<br />
<a href="http://davybrion.com/blog/2008/12/the-resolvable/" rel="nofollow">http://davybrion.com/blog/2008/12/the-resolvable/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten Jacobsen</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-23111</link>
		<dc:creator>Morten Jacobsen</dc:creator>
		<pubDate>Mon, 07 Dec 2009 14:57:05 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-23111</guid>
		<description>I am trying to integrate some of your posts on Castle Windsor and NHibernate, when I ran into a problem.. Being new to both technologies, forgive me if this seems obvious :)..

From this post, it seems that whenever I use Container.Resolve() on a type that implements IDisposable, then I should not use the returned instance in a using statement, but rather wrap it in a try-catch-finally block so I always call Container.Release ?

But in your post about managing NHibernate sessions (http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/) you have the following code:

public ProductCategoryDTO[] GetAllProductCategories()
{
   using (Container.Resolve())
   {
      var repository = Container.Resolve();
      var categories = repository.GetAllProductCategories();
      return categories.ToDTOs();
   }
}

Now my question is this: is this not &quot;wrong&quot; according the information of this post? Doesn&#039;t this mean that the IUnitOfWork instance will never be released from the container since it implements IDispoable?

If so, how would you handle this properly?

Thanks in advance,
Morten Jacobsen</description>
		<content:encoded><![CDATA[<p>I am trying to integrate some of your posts on Castle Windsor and NHibernate, when I ran into a problem.. Being new to both technologies, forgive me if this seems obvious <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ..</p>
<p>From this post, it seems that whenever I use Container.Resolve() on a type that implements IDisposable, then I should not use the returned instance in a using statement, but rather wrap it in a try-catch-finally block so I always call Container.Release ?</p>
<p>But in your post about managing NHibernate sessions (<a href="http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/" rel="nofollow">http://davybrion.com/blog/2008/06/managing-your-nhibernate-sessions/</a>) you have the following code:</p>
<p>public ProductCategoryDTO[] GetAllProductCategories()<br />
{<br />
   using (Container.Resolve())<br />
   {<br />
      var repository = Container.Resolve();<br />
      var categories = repository.GetAllProductCategories();<br />
      return categories.ToDTOs();<br />
   }<br />
}</p>
<p>Now my question is this: is this not &#8220;wrong&#8221; according the information of this post? Doesn&#8217;t this mean that the IUnitOfWork instance will never be released from the container since it implements IDispoable?</p>
<p>If so, how would you handle this properly?</p>
<p>Thanks in advance,<br />
Morten Jacobsen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Whut</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-22965</link>
		<dc:creator>Whut</dc:creator>
		<pubDate>Mon, 16 Nov 2009 14:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-22965</guid>
		<description>You probably should mention that this behavior show itself only if given component implements IDisposable. If not there is no need to call container.Release()

&lt;code&gt;
public interface IMyComponent { }

[TestMethod]
public void ContainerDoesntKeepReferenceToNotDisposableComponent()
{
    var container = CreateContainer();
    var myComponent = container.Resolve();
    Assert.IsFalse(container.Kernel.ReleasePolicy.HasTrack(myComponent));
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>You probably should mention that this behavior show itself only if given component implements IDisposable. If not there is no need to call container.Release()</p>
<p><code><br />
public interface IMyComponent { }</p>
<p>[TestMethod]<br />
public void ContainerDoesntKeepReferenceToNotDisposableComponent()<br />
{<br />
    var container = CreateContainer();<br />
    var myComponent = container.Resolve();<br />
    Assert.IsFalse(container.Kernel.ReleasePolicy.HasTrack(myComponent));<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-8753</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Fri, 13 Feb 2009 14:50:56 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-8753</guid>
		<description>i always grab the latest trunk actually :)</description>
		<content:encoded><![CDATA[<p>i always grab the latest trunk actually <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Howells</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-8750</link>
		<dc:creator>Richard Howells</dc:creator>
		<pubDate>Fri, 13 Feb 2009 13:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-8750</guid>
		<description>What version of Castle are you using?  I downloaded RC3 (Sept 2007) which seems to be the latest on the site.  Your container.Register code will nto compile for me.  No Register method.

&lt;code&gt;
          var container = new WindsorContainer();

            container.Register(... // &lt;---- I have no register method.
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>What version of Castle are you using?  I downloaded RC3 (Sept 2007) which seems to be the latest on the site.  Your container.Register code will nto compile for me.  No Register method.</p>
<p><code><br />
          var container = new WindsorContainer();</p>
<p>            container.Register(... // &lt;---- I have no register method.<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elegant Code &#187; The Resolvable</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6721</link>
		<dc:creator>Elegant Code &#187; The Resolvable</dc:creator>
		<pubDate>Sun, 21 Dec 2008 14:52:37 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6721</guid>
		<description>[...] wrote a post last week about a memory leak i had introduced in my code due to not properly releasing resolved components through the Windsor IoC container. I wanted to try to make sure that i&#8217;d never make that mistake again and this is the approach [...]</description>
		<content:encoded><![CDATA[<p>[...] wrote a post last week about a memory leak i had introduced in my code due to not properly releasing resolved components through the Windsor IoC container. I wanted to try to make sure that i&#8217;d never make that mistake again and this is the approach [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 2008 December 16 - Links for today &#171; My (almost) Daily Links</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6482</link>
		<dc:creator>2008 December 16 - Links for today &#171; My (almost) Daily Links</dc:creator>
		<pubDate>Tue, 16 Dec 2008 08:35:16 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6482</guid>
		<description>[...] Davy Brion on The Importance Of Releasing Your Components Through Windsor [...]</description>
		<content:encoded><![CDATA[<p>[...] Davy Brion on The Importance Of Releasing Your Components Through Windsor [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #244</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6441</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #244</dc:creator>
		<pubDate>Mon, 15 Dec 2008 08:33:21 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6441</guid>
		<description>[...] The Importance Of Releasing Your Components Through Windsor - Davy Brion talks about a memory leak problem he encountered with transient components from the Windsor container. [...]</description>
		<content:encoded><![CDATA[<p>[...] The Importance Of Releasing Your Components Through Windsor &#8211; Davy Brion talks about a memory leak problem he encountered with transient components from the Windsor container. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elegant Code &#187; The Component Burden</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6408</link>
		<dc:creator>Elegant Code &#187; The Component Burden</dc:creator>
		<pubDate>Sun, 14 Dec 2008 12:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6408</guid>
		<description>[...] my previous post i showed you how important it is to properly release the components you&#8217;ve resolved through [...]</description>
		<content:encoded><![CDATA[<p>[...] my previous post i showed you how important it is to properly release the components you&#8217;ve resolved through [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; The Component Burden</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6406</link>
		<dc:creator>The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; The Component Burden</dc:creator>
		<pubDate>Sun, 14 Dec 2008 12:37:28 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6406</guid>
		<description>[...] The Importance Of Releasing Your Components Through Windsor [...]</description>
		<content:encoded><![CDATA[<p>[...] The Importance Of Releasing Your Components Through Windsor [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bart Reyserhove</title>
		<link>http://davybrion.com/blog/2008/12/the-importance-of-releasing-your-components-through-windsor/comment-page-1/#comment-6370</link>
		<dc:creator>Bart Reyserhove</dc:creator>
		<pubDate>Sat, 13 Dec 2008 15:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=718#comment-6370</guid>
		<description>Nice post Davy. Definitely something I&#039;ll check on monday in our application ;-)</description>
		<content:encoded><![CDATA[<p>Nice post Davy. Definitely something I&#8217;ll check on monday in our application <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
