<?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: Memory leak with Enterprise Library 4 Data block and Execute Reader</title>
	<atom:link href="http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/feed/" rel="self" type="application/rss+xml" />
	<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/</link>
	<description>The adventures of a young kiwi software developer in London</description>
	<lastBuildDate>Tue, 31 Jan 2012 19:56:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jinu</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-50418</link>
		<dc:creator>Jinu</dc:creator>
		<pubDate>Wed, 14 Dec 2011 08:51:25 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-50418</guid>
		<description>Thanks..I was searching for this...</description>
		<content:encoded><![CDATA[<p>Thanks..I was searching for this&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew Freyling</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-10395</link>
		<dc:creator>Drew Freyling</dc:creator>
		<pubDate>Fri, 25 Sep 2009 07:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-10395</guid>
		<description>haha i forgot to use xmlreader :(
Might help if I read the article  properly!</description>
		<content:encoded><![CDATA[<p>haha i forgot to use xmlreader :(<br />
Might help if I read the article  properly!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew Freyling</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-10392</link>
		<dc:creator>Drew Freyling</dc:creator>
		<pubDate>Fri, 25 Sep 2009 06:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-10392</guid>
		<description>I just ran a quick test and it used one connection the entire time and once it was finished it quickly released it. No connection pool overflowing at all?
 
            for (int i = 0; i &lt; 10000; i++)
            {
                Database database = DatabaseFactory.CreateDatabase(&quot;ConnectionString&quot;);
                using (DbCommand command = database.GetStoredProcCommand(&quot;[TestProc]&quot;))
                {
                    using (IDataReader rdr = database.ExecuteReader(command))
                    {
                        while (rdr.Read())
                        {
                            Console.WriteLine(rdr.GetString(0));
                        }

                        //    // If you do not explicitly close the connection here, it will leak!
                        //    if (command.Connection.State == ConnectionState.Open)
                        //    {
                        //        command.Connection.Close();
                        //    }
                    }
                }
            }</description>
		<content:encoded><![CDATA[<p>I just ran a quick test and it used one connection the entire time and once it was finished it quickly released it. No connection pool overflowing at all?</p>
<p>            for (int i = 0; i &lt; 10000; i++)<br />
            {<br />
                Database database = DatabaseFactory.CreateDatabase(&quot;ConnectionString&quot;);<br />
                using (DbCommand command = database.GetStoredProcCommand(&quot;[TestProc]&quot;))<br />
                {<br />
                    using (IDataReader rdr = database.ExecuteReader(command))<br />
                    {<br />
                        while (rdr.Read())<br />
                        {<br />
                            Console.WriteLine(rdr.GetString(0));<br />
                        }</p>
<p>                        //    // If you do not explicitly close the connection here, it will leak!<br />
                        //    if (command.Connection.State == ConnectionState.Open)<br />
                        //    {<br />
                        //        command.Connection.Close();<br />
                        //    }<br />
                    }<br />
                }<br />
            }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew Freyling</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-10390</link>
		<dc:creator>Drew Freyling</dc:creator>
		<pubDate>Fri, 25 Sep 2009 05:11:53 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-10390</guid>
		<description>Here is the generated code instead the Repository of the Web Service Software Factory =&gt;
        /// 
        /// Find all objects that match the given criteria.
        /// 
        /// Type of object used to identify
        /// the objects to find.
        /// Factory object that can turn the
        /// identity object into the appropriate DbCommand.
        /// Factory object that can turn the
        /// returned result set into a domain object.
        /// Object that identifies which items to get.
        /// 
        public List Find(
            ISelectionFactory selectionFactory,
            IDomainObjectFactory domainObjectFactory,
            TIdentity identity)
        {
            List results = new List();

            using (DbCommand command = selectionFactory.ConstructSelectCommand(db, identity))
            {
                using (IDataReader rdr = db.ExecuteReader(command))
                {
                    while (rdr.Read())
                    {
                        results.Add(domainObjectFactory.Construct(rdr));
                    }
                }
            }
            return results;
        }

Wouldn&#039;t this do the same?</description>
		<content:encoded><![CDATA[<p>Here is the generated code instead the Repository of the Web Service Software Factory =&gt;<br />
        ///<br />
        /// Find all objects that match the given criteria.<br />
        ///<br />
        /// Type of object used to identify<br />
        /// the objects to find.<br />
        /// Factory object that can turn the<br />
        /// identity object into the appropriate DbCommand.<br />
        /// Factory object that can turn the<br />
        /// returned result set into a domain object.<br />
        /// Object that identifies which items to get.<br />
        ///<br />
        public List Find(<br />
            ISelectionFactory selectionFactory,<br />
            IDomainObjectFactory domainObjectFactory,<br />
            TIdentity identity)<br />
        {<br />
            List results = new List();</p>
<p>            using (DbCommand command = selectionFactory.ConstructSelectCommand(db, identity))<br />
            {<br />
                using (IDataReader rdr = db.ExecuteReader(command))<br />
                {<br />
                    while (rdr.Read())<br />
                    {<br />
                        results.Add(domainObjectFactory.Construct(rdr));<br />
                    }<br />
                }<br />
            }<br />
            return results;<br />
        }</p>
<p>Wouldn&#8217;t this do the same?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-10335</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Thu, 24 Sep 2009 02:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-10335</guid>
		<description>I&#039;m not sure Drew, I would imagine they explicitly close connections already.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure Drew, I would imagine they explicitly close connections already.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew Freyling</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-10280</link>
		<dc:creator>Drew Freyling</dc:creator>
		<pubDate>Wed, 23 Sep 2009 01:25:51 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-10280</guid>
		<description>So this would be a problem with alot of things, including the Web Service Software Factory (Guidance Automation)?</description>
		<content:encoded><![CDATA[<p>So this would be a problem with alot of things, including the Web Service Software Factory (Guidance Automation)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-6111</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Mon, 15 Jun 2009 22:12:04 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-6111</guid>
		<description>@Jamison - I&#039;m not sure. The author of the article (http://msdn.microsoft.com/en-us/library/aa175863.aspx) only mentions data readers, but I guess it could extend to other classes that perform similar behaviour. Make a test case to be sure :)</description>
		<content:encoded><![CDATA[<p>@Jamison &#8211; I&#8217;m not sure. The author of the article (<a href="http://msdn.microsoft.com/en-us/library/aa175863.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa175863.aspx</a>) only mentions data readers, but I guess it could extend to other classes that perform similar behaviour. Make a test case to be sure :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamison White</title>
		<link>http://richarddingwall.name/2009/06/10/memory-leak-with-enterprise-library-4-data-block-and-execute-reader/comment-page-1/#comment-6101</link>
		<dc:creator>Jamison White</dc:creator>
		<pubDate>Mon, 15 Jun 2009 15:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://richarddingwall.name/?p=1447#comment-6101</guid>
		<description>Thanks Richard, 
This has been an ongoing problem for me, and I think this will fix it. You used a data reader here, but do all dbcommandwrapper&#039;s have this problem?
Jamison White</description>
		<content:encoded><![CDATA[<p>Thanks Richard,<br />
This has been an ongoing problem for me, and I think this will fix it. You used a data reader here, but do all dbcommandwrapper&#8217;s have this problem?<br />
Jamison White</p>
]]></content:encoded>
	</item>
</channel>
</rss>

