<?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: Using IDisposables with LINQ</title>
	<atom:link href="http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/</link>
	<description>Git, .NET and more</description>
	<lastBuildDate>Mon, 01 Apr 2013 17:24:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Keith Dahlby</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-7</link>
		<dc:creator>Keith Dahlby</dc:creator>
		<pubDate>Wed, 29 Jul 2009 19:19:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-7</guid>
		<description>@Steve ~

You are indeed correct. However, that workaround doesn&#039;t have the desired effect of allowing additional manipulation of the original query with its original provider. Instead, we&#039;ll just get an IQueryable that uses LINQ to Objects under the hood - we might as well just return IEnumerable&lt;MyType&gt;!

I have a post in the works with an actual fix for IQueryable.

Cheers ~
Keith</description>
		<content:encoded><![CDATA[<p>@Steve ~</p>
<p>You are indeed correct. However, that workaround doesn&#8217;t have the desired effect of allowing additional manipulation of the original query with its original provider. Instead, we&#8217;ll just get an IQueryable that uses LINQ to Objects under the hood &#8211; we might as well just return IEnumerable<mytype>!</p>
<p>I have a post in the works with an actual fix for IQueryable.</p>
<p>Cheers ~<br />
Keith</mytype></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hanselman</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-6</link>
		<dc:creator>Scott Hanselman</dc:creator>
		<pubDate>Wed, 29 Jul 2009 01:52:23 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-6</guid>
		<description>I love this. I&#039;ve forwarded it to the C# designers.</description>
		<content:encoded><![CDATA[<p>I love this. I&#8217;ve forwarded it to the C# designers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-5</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 27 Jul 2009 15:13:26 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-5</guid>
		<description>The code above - does require to be used with a &#039;AsQueryable&#039; to get it to build.

ie.
IQueryable&lt;MyType&gt; MyFunc(string myValue)
{
    return (from dc in new MyDataContext().Use()
           from row in dc.MyTable
           where row.MyField == myValue
           select row).AsQueryable();
}

</description>
		<content:encoded><![CDATA[<p>The code above &#8211; does require to be used with a &#8216;AsQueryable&#8217; to get it to build.</p>
<p>ie.<br />
IQueryable<mytype> MyFunc(string myValue)<br />
{<br />
    return (from dc in new MyDataContext().Use()<br />
           from row in dc.MyTable<br />
           where row.MyField == myValue<br />
           select row).AsQueryable();<br />
}</p>
<p></mytype></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-4</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 27 Jul 2009 14:40:05 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-4</guid>
		<description>I was incorrect on my last post - it is working as expected.

I did a Count(), then attempted to loop over the collection in my test  - after the count call it was disposed.</description>
		<content:encoded><![CDATA[<p>I was incorrect on my last post &#8211; it is working as expected.</p>
<p>I did a Count(), then attempted to loop over the collection in my test  &#8211; after the count call it was disposed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-3</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 27 Jul 2009 14:31:02 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-3</guid>
		<description>When I call result.Count on a similiar example of above I get an error:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: &#039;DataContext accessed after Dispose.&#039;.

Isn&#039;t this code to prevent that from occuring ?</description>
		<content:encoded><![CDATA[<p>When I call result.Count on a similiar example of above I get an error:</p>
<p>System.ObjectDisposedException: Cannot access a disposed object.<br />
Object name: &#8216;DataContext accessed after Dispose.&#8217;.</p>
<p>Isn&#8217;t this code to prevent that from occuring ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alastair Smith</title>
		<link>http://lostechies.com/keithdahlby/2009/07/23/using-idisposables-with-linq/#comment-2</link>
		<dc:creator>Alastair Smith</dc:creator>
		<pubDate>Fri, 24 Jul 2009 13:07:26 +0000</pubDate>
		<guid isPermaLink="false">/blogs/dahlbyk/archive/2009/07/23/using-idisposables-with-linq.aspx#comment-2</guid>
		<description>Wow, that&#039;s a really elegant solution!</description>
		<content:encoded><![CDATA[<p>Wow, that&#8217;s a really elegant solution!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
