Choosing between ADO.NET Entity Framework and LINQ to SQL

Choosing between ADO.NET Entity Framework and LINQ to SQL

  • Comments 10

As part of my day to job I come across a very common question from the developer community that one should be using LINQ to SQL (L2S) or ADO.NET Entity Framework (EF).

 

Earlier I have posted a blog containing the features http://blogs.msdn.com/wriju/archive/2009/01/05/choosing-between-linq-to-sql-and-entity-framework.aspx. 

 

To me I feel very excited about EF as it has got more power and capability than L2S. L2S was important for us to understand the new era of Object Relational Model (ORM) with native programming language querying (LINQ) capabilities. But going forward EF is the technology you should be focusing on.

 

There has been another concern comes from dev community is that is LINQ to SQL going to retire? Answer to that is no. Microsoft will continue to support L2S and enhance based on customer feedback. Tim Mallalieu clearly have mentioned in his Post that Microsoft will heavily invest into EF and the most wanted features like POCO will be with .NET 4.0.

 

EF is the recommended data access solution while accessing data using LINQ. LINQ to SQL will also be there.

 

So when the question arises what to choose? Go ahead and plan for Entity Framework. I would like to share some of my thoughts around it,

 

Why I should use Entity Framework?

Ø       It simplifies the data access and allows me to create conceptual model required for my business.

Ø       EF allows you to handle Many to Many relationship without extra join.

Ø       Map related tables into single entity to reduce code complexity.

Ø       Strong inheritance supports for (Table per hierarchy, subclass and concrete type)

Ø       Consolidation for complex object is very easy.

Ø       It has powerful query mechanism through EntitySQL. For them who do not like LINQ you can use EntityClient provider with EntitySQL.

Ø       You can expose your modeled data through ADO.NET Data Services (Astoria).

Ø       Database independent and based on standard ADO.NET Providers.

Ø       There are many third party providers currently available.

o        Devart offers provider for Oracle, MySQL and PostgreSQL

o        Phoenix Software Solution offers EF provider for SQLite.

o        Npgsql offers another provider for PostgreSQL.   

o        OpenLink Software offers a very wide range of support for Oracle (versions 7.x to 11.x), Microsoft SQL Server (6.x to 2005), IBM DB2 , Sybase (4.2 to 12.x+), IBM Informix (5.x to 11.x), Ingres (6.4 to 9.x), Progress (7.x to 10.x), MySQL, PostgreSQL, and Firebird 

o        Sybase SQL Anywhere provides support for SQL Anywhere.

o        IBM natively supports databases like DB2, Informix and U2.

Ø       <TODO: will add few more as and when come across>

 

Closing

At the end of the story I still feel good about LINQ to SQL when it comes to smaller applications with less complexity. Entity Framework is capable of handling large enterprise applications and will have more power in v2 (in .NET 4.0). So if you are targeting your application for multiple databases the L2S is not the right choice for you.

My vote is for ADO.NET Entity Framework. You will enjoy with the conceptual model and Astoria.  

Namoskar!!!

Leave a Comment
  • Please add 4 and 1 and type the answer here:
  • Post
  • PingBack from http://www.clickandsolve.com/?p=19339

  • Thank you for submitting this cool story - Trackback from DotNetShoutout

  • Or ECO V http://www.capableobjects.com/

  • I have been getting a continuous request on what we should be using? LINQ to SQL or ADO.NET Entity Framework?

  • Well, that's your opinion. I agree with you in that the L2E has many nice features

    "It simplifies the data access and allows me to create conceptual model required for my business."

    -> So does L2S, the conceptual model can be simplified through the use of views.

    Ø       EF allows you to handle Many to Many relationship without extra join.

    -> Too bad for L2S, but again... use views :)

    Ø       Map related tables into single entity to reduce code complexity.

    -> Yup... they told me so, but it doesn't work succesfully.

    Ø       Strong inheritance supports for (Table per hierarchy, subclass and concrete type)

    -> Yup, but then again... isn't that cluttering your layer?

    Ø       Consolidation for complex object is very easy.

    -> Not sure what you mean?

    You forgot to mention that if the relational model changes you've to tear down all your tables in the designer and built it up from scratch again - which is something that just works perfectly in L2S.

    L2E performance is poor, not to mention the funny SQL-statements it sometimes produce.

    I think that Microsoft should put a big effort into joining the C#-team (L2S) with the ADO.NET-team (L2E) and then maybe they could produce something useful, as time is now it's frustrating.

  • Your deduction about LINQ to SQL is wrong. Specifically:

    "There has been another concern comes from dev community is that is LINQ to SQL going to retire? Answer to that is no. Microsoft will continue to support L2S and enhance based on customer feedback. Tim Mallalieu clearly have mentioned in his Post that Microsoft will heavily invest into EF and the most wanted features like POCO will be with .NET 4.0. "

    I read his post and the answer to the question is Yes: LINQ to SQL is going away.  It is being replaced by LINQ to Entities / EF.  He even stated in that post that he wants to know what people use in L2S in order to make sure it is in L2E.  

    In short, there isn't a choice.  Either skip the whole LINQ thing or embrace the entity framework.

  • Thank you for sharıng this information with us.

  • Thanks for the info. It will be nice once this space matures and we don't have to decide on so many different data access options. I've used ado.net, wrote my own custom data access classes, used .netTiers, and Linq to Sql. I'd like to stay ahead of the curve so I'm going to try out the ADO.NET Entity Framework in hopes that this will be around for a while.

  • Thanks for that.  The L2S vs L2EF debate is still live (2010-06-01).  There's ongoing debate, including ease of use and the wisdom of the "canonical form" used to work with different data providers.  A complex area and one size definitely doesn't fit everybody.

    I put up an experimental online application that looks at the choice.

    It helps work through your own thoughts, with notes, links and an email containing a suggestion graphic.

    An introduction to it is at decisionz.wordpress.com/.../suggestions-for-linq-tool-to-use (has a link to the live page).

    It guides your own work, doesn't provide a single recommendation.

    Might be useful to people looking at the choice.

  • thank you, this story is very useful for me!

Page 1 of 1 (10 items)