Monday, December 31, 2018

Difference between Entity framework and LINQ

LINQ only works with SQL Server Databas while Entityframework can works with various databases like Oracle, DB2, MYSQL, SQL Server etc.

LINQ generates a .dbml to maintain the relation while Entityframework generates an .edmx files initially. The relation is maintained using 3 different files .csdl, .msl and .ssdl

LINQ has not support for complex type. Entityframework has support for complex type.

LINQ cannot generate database from model.Entityframework can generate database from model.

LINQ allows only one to one mapping between the entity classes and the relational tables /views.Entityframework allows one-to-one, one-to-many & many-to-many mappings between the Entity classes and the relational tables /views.

LINQ allows you to query data using DataContext.Entityframework allows you to query data using EntitySQL, ObjectContext, DbContext.

LINQ provides a tightly coupled approach.Entityframework provides a loosely coupled approach. Since its code first approach allow you to use Dependency Injection pattern which make it loosely coupled .

No comments:

Followers

Link