Improvements in Entity Framework 4.0

   With .NET 4.0 a lot of new features and technologies will see the light, as long as others will get improved, and Entity Framework will be one of those technologies that will get improved.

   A lot of this changes are being made on the Query pipeline, that means that are being done on the translation from Linq to SQL code, and some of the changes in Beta 1 are the following:

  1. Avoid projecting all columns in nested queries
    • Instead of making a query for the complete set of columns and the make the projection on top of it, just make the projection and get only the needed columns
  2. Avoiding Unnecessary IS NULL Checks in LINQ to Entities Queries
    • remove the Is null check when using Joins
  3. Additional join elimination:  Eliminate parent table in “Child Left Outer Join Parent”
    • Avoid having a child left outer join if no column from that relation is needed for the projection
  4. Using IN instead of nested OR’s
    • Instead of having several Or’s in place such as “CategoryId = 1 OR CategoryID = 2 (…)” have “CategoryId In (1,2,…)”
  5. Translating more of LINQ’s GroupBy operator into GROUP BY
    • Better use of the SQL Group By in order to simplify the query
  6. Avoiding “Cast (1 as bit)”, using “1” instead
  7. Simplifying some queries that go against a subtype in a type hierarchy

   Some of the changes after Beta 1:

  1. Elimination of null sentinels
    • In the output query there is often the constant 1 projected both in nested and in top-most queries. By avoiding it and reusing other columns for the same purpose in many cases we are able to avoid levels of nesting.
  2. Additional Join Elimination
  3. Use of Inner Joins instead of Left Outer Joins when possible
  4. Provide mechanism for efficient queries on non-Unicode columns
    • We now generate non-unicode constants and parameters when these are used in LINQ to Entities queries in comparisons with non-unicode columns. This allows indexes to be used by SQL Server.
  5. Improve the translation of the functions String.StartsWith, String.Contains and String.EndsWith in LINQ to Entites to use LIKE.
  6. Improve the translation of the canonical functions StartsWith, Contains and EndsWith to use LIKE (these canonical functions became available in .NET 4.0 Beta1)
  7. Collapse multiple Case statements into one

   You can read more about this topic on this ADO.NET Team post.

3 comments on “Improvements in Entity Framework 4.0

  1. I strictly recommend not to hold off until you earn enough cash to order all you need! You can get the mortgage loans or just student loan and feel yourself free

  2. Thanks for the nice article close to this post! If you want to buy essays or custom essay search for very good writing services. That’s the right way to the success!

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

* Copy This Password *

* Type Or Paste Password Here *

1,575 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>