Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "Linq to SQL"?

I've had a discussion with a colleague about "Linq to SQL". I am still new at .NET so he thinks I need to learn more. (still, 30 years of general programming experience should count in my advantage, right?) I had read some books and for a new project I decided to use the ADO.NET Entity Data Model. My colleague disagreed because he "knew" that entities had lots of problems. It caused memory leaks at the database server and Microsoft is going to discontinue it anyway. He told me I should use a Data Module instead. Just add a .dbml to my project and use Link on top of this.

He has 5 years of .NET experience, which is 4 years more than my experience.

I stopped myself so I wouldn't call him a moron or idiot or whatever because it appears to me that he thinks that "Link to SQL" == "Entity Data Model"...

Still, I started to have some small doubts. I thought that Linq to SQL is based upon .dbml files, thus based upon data models. And I've heard that Linq to SQL does have a few technical problems and that it's soon to be replaced by the Entity model. If my colleague mixed these two up, then he's an utter moron. But since he has 5 years of experience and since I doubt that my employee would even hire morons, I started to have doubts.

So, what is "Linq to SQL" exactly?

like image 623
Wim ten Brink Avatar asked Aug 22 '09 11:08

Wim ten Brink


People also ask

What is LINQ used for?

Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language. Traditionally, queries against data are expressed as simple strings without type checking at compile time or IntelliSense support.

What is LINQ to SQL classes?

LINQ to SQL is a component of the . NET Framework that provides a run-time infrastructure for managing relational data as objects.

What is difference between LINQ and SQL query?

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

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.


2 Answers

LINQ to SQL and the Entity Framework aren't the same thing, certainly.

They're basically different ORMs, both from Microsoft and both acting as LINQ providers. LINQ to SQL was introduced with .NET 3.5, and the Entity Framework was introduced in .NET 3.5 SP1.

It's true that Microsoft is taking the Entity Framework forward in preference to LINQ to SQL, although many people in the community are urging them to improve LINQ to SQL anyway - it's a simpler framework than EF. In response, Microsoft has said it's going to try to make EF easier to work with when only simple models are required.

LINQ to SQL only works against specific databases - SQL Server and SQL Server CE, mainly. The Entity Framework is (at least theoretically) more database agnostic, so database vendors can plug in their own providers.

like image 109
Jon Skeet Avatar answered Sep 19 '22 11:09

Jon Skeet


If your friend was suggesting that LINQ to Entities is going away, he's got it backward:

LINQ to SQL will continue to be supported but not extended much going forward. LINQ to Entities is here to stay and is Microsoft's preferred data access framework for .NET.

like image 20
Dave Swersky Avatar answered Sep 21 '22 11:09

Dave Swersky