Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dump Linq-To-Sql now that Entity Framework 4.0 has been released?

The relative simplicity of Linq-To-Sql as well as all the criticism leveled at version 1 of Entity Framework (especially, the vote of no confidence) convinced me to go with Linq-To-Sql "for the time being". Now that EF 4.0 is out, I wonder if it's time to start migrating over to it.

Questions:

  1. What are the pros and cons of EF 4.0 relative to Linq-To-Sql?
  2. Is EF 4.0 finally ready for prime time?
  3. Is now the time to switch over?
like image 531
devuxer Avatar asked Apr 23 '10 21:04

devuxer


Video Answer


1 Answers

Well, an endless debate :-)

Yes, I firmly believe EF4 is definitely ready for prime time - Microsoft has done an outstanding job of addressing just about all the annoyances and issues with the 1.0 release of EF.

It's ready for prime time - if you need all its features.

Linq-to-SQL is a pretty straightforward, no-frills, no-nonsense OR mapper - it maps one database table to one CLR object - and that's about it. Very basic, very direct - but a rather thin layer on top of SQL Server.

EF4 on the other hand is much more

  • a conceptual data model in your object space
  • a storage data model on your database layer
  • a mapping layer between the two
  • database-independent

So if you really need support for multiple databases (and not just SQL Server), or if you really need to be able to morph the database structure into a totally different object model - EF4 is a great place to start.

If you have a simple and straightforward little to medium-size app that only needs to be able to easily and quickly map tables 1:1 to objects, then I don't think EF4 comes even close in terms of simplicity and performance to Linq-to-SQL.

EF4 is great - and if you need its power - go with it!

But if your requirements are a lot less, it might just be overkill - continue to use Linq-to-SQL (I will) and be happy with it. I don't see any good reason to dump Linq-to-SQL - it's still totally available in .NET 4, has been blessed with some bug fixes and improvements even, and it will be around for at least another couple of years.

like image 189
marc_s Avatar answered Sep 20 '22 12:09

marc_s