Please enable Javascript to correctly display the contents on Dot Net Tricks!
;

Difference between LINQ to SQL and Entity Framework

Posted By : Shailendra Chauhan, 30 Mar 2014
Updated On : 31 Mar 2014
Total Views : 75,740   
 

LINQ 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.

LINQ to SQL
Entity Framework
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 entity classes and the relational tables /views.
It allows one-to-one, one-to-many & many-to-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 only with SQL Server.
It can be used for rapid application development with RDBMS like SQL Server, Oracle, DB2 and MySQL etc.
What do you think?

I hope you will enjoy the LINQ to SQL and EF while playing with database. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

 
 
About the Author
Hey! I'm Shailendra Chauhan full-time author, consultant & trainer. I have more than 6 years of hand over Microsoft .NET technologies and other web technologies like JavaScript, AngularJS, NodeJS etc. I am an entrepreneur, the founder & chief editor of www.dotnet-tricks.com and www.dotnettricks.com. I am author of most popular e-books for technical Interview on ASP.NET MVC Interview Questions and Answers & AngularJS Interview Questions and Answers & LINQ Interview Questions and Answers.
I have delivered 100+ training sessions to professional world-wide over Microsoft .NET technologies such C#, ASP.NET MVC, WCF, Entity Framework and other mobile technologies such Ionic, PhoneGap, Corodva. Read more...
 
Free Interview Books
 
23 APR
NodeJS Development (offline)

Sat, Sun (10:00 AM-12:00 PM IST)

More Details
16 APR
ASP.NET MVC with AngularJS Development (offline)

Sat, Sun (8:00 AM-10:00 AM IST)

More Details
11 APR
ASP.NET MVC with AngularJS Development (online)

Mon-Fri (7:00 AM-9:00 AM IST)

More Details
2 APR
ASP.NET MVC with AngularJS Development (offline)

Sat, Sun (4:00 PM-6:00 PM IST)

More Details
19 MAR
ASP.NET MVC with AngularJS Development (online)

Mon - Fri     (8:30 PM-10:30 PM IST)

25 FEB
NodeJS Development (online)

Mon-Fri     (7:00 AM-9:00 AM IST)

21 FEB
ASP.NET MVC with AngularJS Development (offline)

Sat, Sun     (3:00 PM-5:00 PM IST)

6 FEB
NodeJS Development (offline)

Sat, Sun     (10:00 AM-12:00 PM IST)

31 JAN
ASP.NET MVC with AngularJS Development (offline)

Sat, Sun     (8:00 AM-10:00 AM IST)

31 JAN
ASP.NET MVC with AngularJS Development (offline)

Sat, Sun     (4:00 PM-6:00 PM IST)

4 JAN
.NET Development (offline)

Mon-Fri     (9:00 AM-11:00 AM IST)

BROWSE BY CATEGORY
 
SUBSCRIBE TO LATEST NEWS
 
LIKE US ON FACEBOOK
 
+