Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it sensible to start a new enterprise large web application with linq2sql in 2012

What is the current status of linq2sql and is it sensible to use it still?

I am about to start a very large project and have quite a lot of experience with it.

However I don't want to avoid EF if that is really the way to go. I do like the simplicity of linq2sql.

like image 498
Chris Barry Avatar asked Jan 20 '26 13:01

Chris Barry


2 Answers

In my opinion: no.

Why?

  • EF in v4 is just as easy to get started with as Linq-to-SQL

  • EF 4 also has options to do more complicated and advanced things - if you need to. No luck in Linq-to-SQL, really - it's simplicity is all there is - no advanced features

  • EF 4 has various approaches to building your system - Linq-to-SQL only has "database-first"

  • EF 4 allows you to update your model (if you're using the database-first approach) if your underlying database ever changes - is there any change it might?? No such luck with Linq-to-SQL - drop the table and drag it back on; tough luck if you modified table or column names, or added additional e.g. associations...

  • Linq-to-SQL was really more of a proof of concept to show off the capabilities of LINQ, developed by the C# language team. It was never really meant to be a full-fledged ORM. EF on the other hand was developed by the ADO.NET database team, and was intended to be a real enterprise-grade ORM / conceptual data model. Linq-to-SQL will not see any further development to speak of - maybe a bugfix here or there. EF on the other hand is Microsoft's strategic platform - they'll heavily invest in it and continue development here (see e.g. the "EF Migrations" to automagically update your database schema from within code).

My personal take: if you start new and you're on .NET 4 (or can go with it): go with EF v4. You can't go wrong, you have all the niceties of Linq-to-SQL - and then quite a few more, if you need them some time in the future....

like image 198
marc_s Avatar answered Jan 23 '26 02:01

marc_s


Personally I'd try to make it such that the database layer is an implementation detail, behind a view-model, repository layer, and other such devices. Then the only question is:

does it work?

To which the answer will probably be "yes", but by abstrating that you can change it without much risk / re-work. Perhaps to the "fuller" ORMs (NH, EF, LLBLGen etc) - or perhaps the lighter micro-ORMs (dapper, simple.data, massive etc).

If L2S lets you get started quicky, there's no reason it can't be used. It might not be my first choice now, but it is a good tool, and I find it more intuitive than EF in many areas.

The key, though, is not painting yourself into a technological corner where change is too expensive.

like image 43
Marc Gravell Avatar answered Jan 23 '26 03:01

Marc Gravell