Linq2SQL vs EF in .net Framework 4.0

So what's the verdict on these two products now? I can't seem to find anything regarding this issue SPECIFICALLY for VS2010/.net 4.0

Back in .net 3.5 days, most people believe Linq2SQL will be dead when .net 4.0 comes around, but it seems alive and well.

On the other hand, EF 4.0 seems to have gotten significant improvement.

For me, most of my work so far are small to medium sized projects, and my company is migrating from VS08 to VS10 soonish. What should I be looking at? Or really, should I spend the time studying EF4.0 or would it be time more well spent looking at nHibernate? (But back on topic, I'm really more interested in Linq2Sql - EF.)

Lastly, I am currently using entlib / unity, which framework is more friendly for dependency/policy injection?

Thanks in advance.


Here are some reasons why Entity Framework (v4) is better:

1 - L2SQL is essentially obsolete

2 - L2SQL does not support POCO mapping, EF does.

3 - EF has more flexibility (code first, model first, database first). L2SQL has only 1.

4 - EF has support for SPROC -> POCO mapping

5 - EF has Entity-SQL, allowing you to go back to classic ADO.NET when required

6 - EF supports inheritance (TPT, TPH)

7 - EF goes hand-in-hand with Repository pattern, and deferred execution via IQueryable

8 - EF components (ObjectSet, ObjectContext) are easily mockable and allow for DI

I cannot think of any reason why new projects should use L2SQL.

Some might say "Well L2SQL is good for small projects, i can drag and drop and be done with it".

Well you can do that with EF4 as well, and you'll have more flexibility/support in the long run if you decide to modify/grow your project. So that is not an excuse.


Need Your Help

How to update inner array in MongoDb document

php mongodb

I'm trying to add php array to MongoDB document

Return false not working sometimes

javascript jquery hyperlink return-value

I have a page with photo gallery