I'm a little bit confused about these two terms "Linq to SQL" and "Entity Framework". I have the general idea that both of them somehow allow you to refer to database tables as .net objects or something of the sort, but please explain to me the difference between these two terms.
-
1This question is just too broad. There are literally dozens of books on each of these topics and to actually answer this question would take another book.– SoylentGrayCommented Dec 6, 2011 at 17:00
-
@Chad: You're wrong. Please see Jalayn's answer.– Jim G.Commented Dec 6, 2011 at 19:15
-
@JimG - It is the best way to address this question and upvoted the answer but it really doesnt answer the question, rather it points to other questions and places where the op can do research.– SoylentGrayCommented Dec 6, 2011 at 19:17
-
Hi Rice Flour Cookies, this type of question about development tools is off-topic here: for that you want Stack Overflow. However, Jalayn's answer links to multiple discussions about this very issue: be sure to check those out.– user8Commented Dec 6, 2011 at 20:18
1 Answer
This subject has already been covered several times, you may be interested in reading:
- https://stackoverflow.com/questions/8676/entity-framework-vs-linq-to-sql. The top answer is short and right on the spot although a little bit dated (2008)
- https://stackoverflow.com/questions/3293995/what-is-the-difference-between-entity-framework-and-linq-to-sql-by-net-4-0. More specifically related to the 4.0 version of the framework.
- http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/dc83097e-9c70-4970-93e2-dbc8636eb321 (I took this link from the answer provided by @jlnorsworthy in Should I be learning Linq, Direct SQL Commands (in .net), EF or other?)
They are similar in that they both are ORM-based but EF is more "enterprisey" and feature-complete than Linq. EF is more comparable to NHibernate as for the available features and has matured with the release of .NET 4.0. Also, one of the most important things to keep in mind is that Linq will lead you into trouble if your DBMS is not part of the SQL Server family (be it "Express" or "Compact").
Edit: as @jkohlhepp has stated in the comment below, Linq to SQL is in maintenance mode (not Linq! thanks to Randy), so no more new features only bug corrections will be done. As such, it really is recommended to start new projects with EF.
-
4All good points. But also bear in mind that Linq to SQL is basically in maintenance mode. Microsoft has stated that they only plan on investing further in EF. So I wouldn't recommend doing new stuff in L2S I would definitely use EF. Commented Dec 6, 2011 at 16:16
-
@jkohlhepp Thanks, that's a good point, I'll edit my answer and include your remark.– JalaynCommented Dec 6, 2011 at 16:19
-
2"Linq is in maintenance mode..." That is not true. Linq to SQL is in maintenance mode. Linq (which L2S is built on top of) is most certainly not. Commented Dec 6, 2011 at 18:51