Вселенная Кудзу

«Программирование - искусство, воюющее со своими творцами»

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.




Using PayPal?
Read this


LINQ to SQL vs. Entity Framework

There is a battle brewing between LINQ to SQL and the upcoming Entity Framework. Some say that it is already settled and that LINQ to SQL is DOA, destined to be replaced by Entity Framework. I do not think it is quite that simple though and both have a role in the mid term, and quite possibly in the long term.

A blog post Is the ADO.NET Team Abandoning LINQ to SQL? has generated quite a discussion. In short it claims that LINQ to SQL is almost dead on arrival and soon to be replaced by entity framework.

LINQ to SQL was originally designed to allow other databases to be supported. However just prior to its release and for a non technical reason it was restricted to work only with SQL Server. In fact because LINQ to SQL was announced shortly after a released my SQL library I abandoned it as they were very similar. Now I am giving consideration to resurrect it and integrate it with LINQ.

LINQ to SQL has not been completely ignored however and is now integrated with SQL Server 2008. Many see LINQ to SQL as an ORM, however I see it as a replacement for the times when I do need to write SQL. Being integrated with SQL Server and SQLCLR makes it a good replacement for T-SQL. Note however that T-SQL in many cases is still faster, but when you need to do something beyond just SQL statements, T-SQL is much more difficult to use and slower with processing. Further advances could narrow this gap as well. There are also scenarios where I need to directly interact with the database from .NET and I do not need an ORM. In such cases I much prefer LINQ to SQL rather than sending over literal strings using ADO.NET.

MSDN has an article comparing the two. I am currently evaluating the latest release of Entity Framework, but the last time I looked it was weak in this area. This makes sense however as Entity Framework focuses on being full ORM. Maybe in future builds a lower layer of Entity Framework will be released that will address this, however why? Why not support LINQ to SQL as the layer that should be used when you need to talk directly to the database, and Entity Framework as the ORM tool that can do transformations?

In summary - why not develop Entity Framework to be the ORM, and LINQ to SQL to serve as embedded SQL? This keeps their functions separate and they both fill valid roles.

<< Previous Entry  Next Entry >>

Comments: 


Add your comment: 

Name:    
E-Mail:  
URL:  
Comment:  
Please add 2 and 5 and type the answer here:



Use my contact form to contact me directly.