Difference Between LINQ To SQL and Entity Framework
Difference Between LINQ To SQL and Entity Framework
L INQ to SQL allow you to query and modify SQL Server database by using LINQ syntax. Entity
framework is a great ORM shipped by Microsoft which allow you to query and modify RDBMS like SQL
Server, Oracle, DB2 and MySQL etc. by using LINQ syntax. Today, EF is widely used by each and every .NET
application to query to database. The difference between LINQ to SQL and EF is given below.
It only works with SQL Server Database. It can works with various databases like Oracle, DB2,
MYSQL, SQL Server etc.
It generates a .dbml to maintain the relation It generates an .edmx files initially. The relation is
maintained using 3 different files .csdl, .msl and .ssdl
It has not support for complex type. It has support for complex type.
It cannot generate database from model. It can generate database from model.
It allows only one to one mapping between the It allows one-to-one, one-to-many & many-to-
entity classes and the relational tables /views. many mappings between the Entity classes and the
relational tables /views
It allows you to query data using DataContext. It allows you to query data using EntitySQL,
ObjectContext, DbContext.
It provides a tightly coupled approach. It provides a loosely coupled approach. Since its code
first approach allow you to use Dependency Injection
pattern which make it loosely coupled .
It can be used for rapid application development It can be used for rapid application development
only with SQL Server. with RDBMS like SQL Server, Oracle, DB2 and
MySQL etc.
http://www.dotnet-tricks.com/Tutorial/entityframework/1M5W300314-Difference-between-LINQ-to-SQL-and-Entity-Framework.html 1/2
6/28/2014 Difference between LINQ to SQL and Entity Framework
Print Article
Tw eet
Shailendra Chauhan works as Software Analyst at reputed MNC and has more than 5 years of hand
over Microsoft .NET technologies. He is a .NET Consultant and is the founder & chief editor of
www.dotnet-tricks.com and www.dotnetinterviewtricks.com blogs. He is an author of book ASP.NET
MVC Interview Questions and Answers.
He loves to work with web applications and mobile apps using Microsoft technology including ASP.NET,
MVC, C#, SQL Server, WCF, Web API, Entity Framework,Cloud Computing, Windows Azure, jQuery,
jQuery Mobile, Knockout.js, Angular.js and many more web technologies. More...
http://www.dotnet-tricks.com/Tutorial/entityframework/1M5W300314-Difference-between-LINQ-to-SQL-and-Entity-Framework.html 2/2