Monday, 8 September 2014

What is the difference between LINQ to SQL and Entity Framework in c#?



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.


No comments:

Post a Comment