Check out this link for a quick comparison. For me linq to sql is a quicker way to get a small application up and running and the entity framework is more for large more complex applications that you can take time to build a big foundation for.
They are somewhat similar, and can be used in a very similar way, code-wise, but they have some important differences. Note that "LINQ" is not the same thing as "LINQ to SQL"; the EF also uses LINQ. Some notable differences are:
Check out this link for a quick comparison. For me linq to sql is a quicker way to get a small application up and running and the entity framework is more for large more complex applications that you can take time to build a big foundation for.
Briefly:
Linq-to-SQL is:
--> so Linq-to-SQL works, and quite well in .NET 3.5 - but don't expect anything new here....
Entity Framework (at least in .NET v4 and up) is:
--> Entity Framework is my clear choice for .NET 4 and newer
S.No | LINQ To SQL | Entity Framework |
1. | LINQ to SQL only works with SQL Server. | It works with various RDBMS like Oracle, MySQL, SQL Server, DB2 |
2 | LINQ to SQL cannot generate the database based on model classes. | Entity Framework generates the database based on model classes |
3 | LINQ to SQL uses the Data Context class to interact with a database. | Entity Framework generates the DBContext class to interact with the database. |
4 | LINQ to SQL is tightly coupled. | Entity Framework is Loosely Coupled |
5 | It supports only 1-1 relation while mapping the relational tables with classes. | It supports the 1-1, 1-*, *-1, *-* relation while mapping relation tables with classes |
6 | It does not support the complex type. | It supports the complex type |
7 | It will generate the DBML file (Database Mark up Language) and the file with 3 sections to represents the schema: csdl, msl,ssdl | It generates the .EDMX file (Entity Data Model Extension) |
8 | Very slow for the first query | Very slow for the first query. But overall performance is better than LINQ TO SQL |
9 | Rapid Development | Development time is slower than LINQ to SQL but it provides more capabilities |
10 | LINQ TO SQL works based on ORM Pattern | Entity Framework also works based on ORM Pattern |