Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a bad idea to jump into LINQ to SQL now?

I have been using ADO.NET in favor of LINQ to SQL (or Entities) up to this point. I'm starting a new project that should be smallish, at least at first but I would like to have room to expand down the line.

I feel now is a good time to get into LINQ. I've avoided it for quite a while; however, I'm concerned by the current direction of LINQ to SQL. I hear LINQ to Entities is going to be MS's preferred data access in the future. I'd rather not get into LINQ to Entities because: 1.) Most likely a steeper learning curve that I don't want to throw into the mix right now (already busy learning MVC) and 2.) I hear it's not ready for primetime.

My concern is this - if I start a project with LINQ to SQL now, can I easily upgrade it to LINQ to Entities down the line?

like image 661
Mike Avatar asked Oct 03 '09 13:10

Mike


People also ask

Is LINQ to SQL still used?

LINQ to SQL was the first object-relational mapping technology released by Microsoft. It works well in basic scenarios and continues to be supported in Visual Studio, but it's no longer under active development.

Which is better LINQ or SQL?

The main difference between LINQ and SQL is that LINQ is a Microsoft . NET framework component, which adds native data querying capabilities to . NET languages, while SQL is a standard language to store and manage data in RDBMS.

Which is faster SQL or LINQ?

Stored procedures are faster as compared to LINQ query since they have a predictable execution plan and can take the full advantage of SQL features. Hence, when a stored procedure is being executed next time, the database used the cached execution plan to execute that stored procedure.

Is LINQ converted to SQL?

LINQ to SQL translates the queries you write into equivalent SQL queries and sends them to the server for processing. More specifically, your application uses the LINQ to SQL API to request query execution. The LINQ to SQL provider then transforms the query into SQL text and delegates execution to the ADO provider.


2 Answers

LINQ to Entities is ready for primetime, and not necessarily much steeper to learn. However, LINQ to SQL is fine too, you'll learn a lot that will stay useful as you move forward.

In short, choose whatever suits the project best. If SQL Server is and will remain the DB platform, and if there's no need for remapping tables or other sophisticated tricks, LINQ to SQL will get you there very fast. It's also very efficient.

like image 90
Tor Haugen Avatar answered Oct 08 '22 15:10

Tor Haugen


If your app is going into production before .net 4.0 SP1 is available, go for L2S. Linq-to-SQL is stable, it will not go away anytime soon, and it generates great SQL. EF v1 don't. Period. Check out the MSDN EF forum if you want to know more about the EFv1 childhood diseases.

Whether EFv2 will be up to the task remains to be seen; I have only used beta 1 and that one does not have some of the improvements that later versions are said to have.

The "L2S vs EF" topic has been covered numerous times already, check out:
Is LINQ to SQL Dead or Alive?

...and personally, I think that Anders Hejlsberg's statement to Redmond Developer News makes it clear enough. "LINQ to SQL is not dead. I can assure you, it is not dead. Nothing ever goes away. We have never done that and we never will," he said.

http://reddevnews.com/blogs/desmond-file/2008/12/digital-darwinism.aspx

like image 39
KristoferA Avatar answered Oct 08 '22 15:10

KristoferA