<?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>Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx</link><description>The information in this post is out of date. 
 Visit msdn.com/data/ef for the latest information on current and past releases of EF. 
 
 
 In a previous post ( http://blogs.msdn.com/adonet/archive/2009/08/05/improvements-to-the-generated-sql-in-net</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10242097</link><pubDate>Mon, 28 Nov 2011 18:06:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242097</guid><dc:creator>Diego B Vega</dc:creator><description>&lt;p&gt;@Mike Emerson: Thanks for bringing this up. A fix for this issue will be included in the update for the EF core libraries in .NET 4.5.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242097" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10242025</link><pubDate>Mon, 28 Nov 2011 15:37:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242025</guid><dc:creator>Mike Emerson</dc:creator><description>&lt;p&gt;The bug with comparing ASCII strings with unicode mentioned in point 5 still exists when LINQ to Entities produces an IN clause. &amp;nbsp;For example if I put into my query:&lt;/p&gt;
&lt;p&gt;(status == &amp;quot;A&amp;quot; || status == &amp;quot;B&amp;quot;)&lt;/p&gt;
&lt;p&gt;where status is a non-unicode string, Linq-to-Entities produces the SQL query:&lt;/p&gt;
&lt;p&gt;where status in ( N&amp;#39;A&amp;#39;, N&amp;#39;B&amp;#39;)&lt;/p&gt;
&lt;p&gt;which causes serious performance issues. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242025" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10123306</link><pubDate>Tue, 01 Feb 2011 19:44:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10123306</guid><dc:creator>Yogesh</dc:creator><description>&lt;p&gt;We have an application which has the entity model created using vs2008 and at some point the project was upgraded to vs2010. However reading this blog, I observerd that the end SQL being generated by the application is still using the older version of .NET 3.5. &lt;/p&gt;
&lt;p&gt;For ex: StartsWith operator used by the Ado.net dataservices still translates to the ncharindex sql call.&lt;/p&gt;
&lt;p&gt;Is there anything specifically that needs to be done so that the application uses the EF4 version and generate the much improved sql?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10123306" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10084153</link><pubDate>Mon, 01 Nov 2010 17:08:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10084153</guid><dc:creator>Ron Ward</dc:creator><description>&lt;p&gt;Re point 5 above. &amp;nbsp;Seems to work correctly with string constants, variables of type string, not so much. &amp;nbsp;Can someone point me toward a solution or at least some additional discussion on the matter.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10084153" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10080816</link><pubDate>Tue, 26 Oct 2010 09:14:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10080816</guid><dc:creator>Vitor Castro</dc:creator><description>&lt;p&gt;Sorry, this comment was on done on the wrong post, please ignore&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080816" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10080812</link><pubDate>Tue, 26 Oct 2010 09:12:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10080812</guid><dc:creator>Vitor Castro</dc:creator><description>&lt;p&gt;One question on TPH:&lt;/p&gt;
&lt;p&gt;I have a scenario where I have a base abstract entity from which two types derive. One of these types is concrete while the other is abstract. From this second abstract type another concrete type is derived leaving me with this structure:&lt;/p&gt;
&lt;p&gt;AbsT1&lt;/p&gt;
&lt;p&gt;|--- ConcT1&lt;/p&gt;
&lt;p&gt;|--- AbsT2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |--- ConcT2&lt;/p&gt;
&lt;p&gt;This conceptual model is then mapped to a single table in the storage model (TPH). This table has a column to identify the type of record being stored.&lt;/p&gt;
&lt;p&gt;In these mappings, conditions are added to both concrete types to get this column fixed values for each case.&lt;/p&gt;
&lt;p&gt;Under this condition I always get mapping errors stating that ConcT1 and ConcT2 are mapped to the same rows in the table which in my oppinion shouldn&amp;#39;t happen.&lt;/p&gt;
&lt;p&gt;Additionally if I derive ConcT1 from AbsT2 instead, keeping everything else the same, all mapping errors are gone and everything works as expected. Another way of making things &amp;#39;work&amp;#39; is to make both abstract types concrete instead.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve already posted this scenario on Connect but no solution as of yet. Can you shed some light on this scenario?&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080812" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10080785</link><pubDate>Tue, 26 Oct 2010 08:16:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10080785</guid><dc:creator>Frans Bouma</dc:creator><description>&lt;p&gt;Actually, point 5 isn&amp;#39;t true, it still doesn&amp;#39;t work, as I reported on the data-access mailing list. It would be great if someone from the team could update this post to enlight that issue. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080785" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10016143</link><pubDate>Thu, 27 May 2010 07:56:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10016143</guid><dc:creator>Daniel Simmons</dc:creator><description>&lt;p&gt;@Steve J,&lt;/p&gt;
&lt;p&gt;What version of Entity Framework are you using? &amp;nbsp;I&amp;#39;m pretty sure we did make a change to help with parameter name consistency that should be in the RTM version of EF 4, but I&amp;#39;d like to confirm that you are using something earlier than that. &amp;nbsp;If you are seeing this with EF 4 RTM, then I&amp;#39;d like to follow-up.&lt;/p&gt;
&lt;p&gt;@Mark,&lt;/p&gt;
&lt;p&gt;Unfortunately we haven&amp;#39;t made any changes to include in EF4. &amp;nbsp;The reason Include uses joins is because that&amp;#39;s the most straightforward way to guarantee a consistent snapshot of results. &amp;nbsp;If you make separate statements (unless you have a ridiculously restrictive isolation level), then you run the risk of something changing between the first select statement and the second one which could cause your data to be inconsistent. &amp;nbsp;Additionally, the thought is that if you are willing to take that risk, then you can always write two or more queries yourself without using include.&lt;/p&gt;
&lt;p&gt;That said, more flexible fetch plans is one of the things on our backlog for future improvements to include. &amp;nbsp;I&amp;#39;m just not sure yet when it will hit the top of the list.&lt;/p&gt;
&lt;p&gt;- Danny&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10016143" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10015438</link><pubDate>Wed, 26 May 2010 08:36:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10015438</guid><dc:creator>Mark White</dc:creator><description>&lt;p&gt;Any improvments to how Included entities are loaded?&lt;/p&gt;
&lt;p&gt;I&amp;#39;d really like to see includes handled as seperate select statements, rather than joins.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10015438" width="1" height="1"&gt;</description></item><item><title>re: Improvements to Generated SQL in .NET 4.0</title><link>http://blogs.msdn.com/b/adonet/archive/2010/05/10/improvements-to-generated-sql-in-net-4-0.aspx#10011764</link><pubDate>Wed, 12 May 2010 15:40:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10011764</guid><dc:creator>Steve J</dc:creator><description>&lt;p&gt;Question about the generated SQL. &amp;nbsp;In the current version of the Entity Framework, consecutive executions of a linq query keeps changing the name of the parameters. &amp;nbsp; For example, the first execution of a linq query a parameter could be named something like @p__linq__5. &amp;nbsp;The next execution the parameter has changed to @p__linq__23 or something similar. &amp;nbsp;This is killing our SQL Server because it cant reuse the query plan for the generated sql.&lt;/p&gt;
&lt;p&gt;We cant use compiled queries because our web site is very dynamic allowing sorting, &amp;nbsp;filtering and searching. &amp;nbsp;We have to dynamically build the conditions before execution of the query. &amp;nbsp;This prevents the query from being compiled. &amp;nbsp;Granted, the different conditions would also cause a recompile on the sql server but there would still be some re-use because a lot of queries would search with the same criteria.&lt;/p&gt;
&lt;p&gt;So, have you implemented a consistent naming method for the parameters?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10011764" width="1" height="1"&gt;</description></item></channel></rss>