LINQ to SQL vs LINQ to Entities

October 21, 2007 19:08 by steve

With Microsoft .NET 3.5 on the horizon a lot of hype has been around Microsoft’s new Language Integrated Query (LINQ).  So what is LINQ?  LINQ is a set of extensions to the .NET Framework that provides the facility to query in-memory and external data.  When Visual Studio 2008 ships later this year, LINQ will support query in-memory objects (LINQ), XML (XLINQ), ADO.NET DataSets (LINQ to DataSet) and SQL Server (LINQ to SQL).

Next year, probably Q2 2008, Microsoft will release the ADO.NET Entity Framework.  The Framework will fully support LINQ through LINQ to Entities.  LINQ to SQL and the ADO.NET Entity Framework are both an O/RM (Object Relational Mapper) that enables you to map entities to your data source. 

So when should you use one over the other?  Well, if you’re using anything that isn’t SQL Server for your data store then the ADO.NET Entity Framework is your only option as LINQ to SQL only works with SQL Server.  If you are using SQL Server though, you still have the choice between the two technologies.  In simple terms, the ADO.NET Entity Framework is the big brother of LINQ to SQL and if your application requires one or more of the following then you should choose the ADO.NET Entity Framework:

  • Mapping a single class to multiple tables
  • Mapping to inheritance
  • Mapping directly many-to-many relationships
  • Mapping to a query
  • Querying a database that isn’t SQL Server
  • The ability to share the data model across other services such as Reporting Services, Integration Services etc.

The above lists just a few major differences between the two technologies. 


Scott Guthrie has a great overview of LINQ to SQL on his blog.


Currently rated 2.5 by 2 people

  • Currently 2.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag





August 28. 2008 01:00