<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Linq Compiled Queries Q &amp;amp; A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx</link><description>I did a series of postings on Linq Compiled Queries last year, I recently got some questions on those postings that I thought would be of general interest. Q1: Why use the 'new' keyword in this snippet? var q = from o in nw.Orders select new {o.everything</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Linq Compiled Queries Q&amp;A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx#8895341</link><pubDate>Tue, 26 Aug 2008 01:43:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8895341</guid><dc:creator>Anders Borum</dc:creator><description>&lt;p&gt;Compiled queries for the win! \o/ :-)&lt;/p&gt;
</description></item><item><title>re: Linq Compiled Queries Q&amp;A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx#8896304</link><pubDate>Tue, 26 Aug 2008 09:14:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8896304</guid><dc:creator>Alexander Gornik</dc:creator><description>&lt;p&gt;Rico, about the linq performance.&lt;/p&gt;
&lt;p&gt;Didn't the linq team thought about massive insert / update scenarios? &lt;/p&gt;
&lt;p&gt;Our experience shows that you simply can't insert more than several thousand entites (2000-3000) in one datacaontext. Performance in that case seems to fall exponentially (i guess, due to some internal entity graph manipulation). We had to use SqlBulkCopy for that.&lt;/p&gt;
&lt;p&gt;And the massive update scenario isn't just supported. Although i can easely imagine something like that:&lt;/p&gt;
&lt;p&gt;users.Where(u =&amp;gt; u.Role == &amp;quot;Operator&amp;quot;).Set(u =&amp;gt; u.Status = &amp;quot;Locked&amp;quot;)&lt;/p&gt;
</description></item><item><title>re: Linq Compiled Queries Q&amp;A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx#8897617</link><pubDate>Tue, 26 Aug 2008 18:22:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8897617</guid><dc:creator>ricom</dc:creator><description>&lt;p&gt;My impression was that they only went for a core slice of the database operations. &amp;nbsp;It's not everything but it's definately not nothing :)&lt;/p&gt;
&lt;p&gt;Now, interestingly, I think anybody could come along and implement the .Set operator you're talking about there. &amp;nbsp;You can use the select statement that everything before the Set would have generated and then look at the expression tree for the mapping function in the .Set, figure out which columns to change then make something like&lt;/p&gt;
&lt;p&gt;update foo set &amp;lt;whatever&amp;gt; where foo in (the select statement from before the select)&lt;/p&gt;
&lt;p&gt;The hardest part I think is figuring out how you want to express compound updates (many columns into related values).&lt;/p&gt;
&lt;p&gt;I'm not a Linq internals expert by any means but I did build a conceptual query engine many years ago (on top of OLEDB) and the above is how our updates worked.&lt;/p&gt;
</description></item><item><title>re: Linq Compiled Queries Q&amp;A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx#8899219</link><pubDate>Wed, 27 Aug 2008 10:23:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8899219</guid><dc:creator>Alexander Gornik</dc:creator><description>&lt;p&gt;Thanks for the reply.&lt;/p&gt;
&lt;p&gt;Interesting part about the updates, although it's definitely not that easy to implement with decent quality. :)&lt;/p&gt;
&lt;p&gt;And the insert problem is still here.&lt;/p&gt;
&lt;p&gt;It's even more sad, that EF doesn't handle this issues too, as it seems to me now.&lt;/p&gt;
&lt;p&gt;p.s: where foo in ... can also produce pretty ineffective queries, imho, but at least we can pray for query optimizer here :).&lt;/p&gt;
</description></item><item><title>re: Linq Compiled Queries Q&amp;A</title><link>http://blogs.msdn.com/ricom/archive/2008/08/25/linq-compiled-queries-q-a.aspx#8900794</link><pubDate>Wed, 27 Aug 2008 20:01:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8900794</guid><dc:creator>ricom</dc:creator><description>&lt;p&gt;Actually since about SQL2005 &amp;quot;where foo in (...)&amp;quot; has been really about the same plan quality as an inner join (it really is just another way of writing an inner join after all) in all the cases I've had to use it. &amp;nbsp;So that's a good thing :)&lt;/p&gt;
</description></item></channel></rss>