Tuesday, 21 June 2016

Difference between LINQ to SQL and Entity Framework:

Difference between LINQ to SQL and Entity Framework:

LINQ to SQL:
  • It only works with SQL Server Database.
  • It generates a .dbml to maintain the relation
  • It has not support for complex type.
  • It cannot generate database from model.
  • It allows only one to one mapping between the entity classes and the relational tables /views.
  • It allows you to query data using DataContext.
  • It provides a tightly coupled approach.
  • It can be used for rapid application development only with SQL Server.
Entity Framework
  • It can works with various databases like Oracle, DB2, MYSQL, SQL Server etc.
  • It generates an .edmx files initially. The relation is maintained using 3 different files .csdl, .msl and .ssdl
  • It has support for complex type.
  • It can generate database from model.
  • 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 EntitySQL, ObjectContext, DbContext.
  • 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 with RDBMS like SQL Server, Oracle, DB2 and MySQL etc.

No comments: