Difference Between LINQ to SQL and Entity Framework
Posted by Viral Sarvaiya on August 14, 2012
In my current company we have discussion about what is the difference between LINQ to SQL Vs Entity Framework and I get following conclusion from the surfing from internet (off course from google. 🙂 )
LINQ to SQL supports one to one mapping of database table or views or procedures or functions
Entity Framework map single class to multiple tables of database. Means you can map one table to multiple entities or multiple table to one entities.
LINQ to SQL does not support the creation of complex types
Entity Framework support the creation of complex types.
LINQ to SQL is easy to use
Entity framework is more complex compared to LINQ to SQL.
While introduction of LINQ to SQL it supports only sql server and letter on “DBLINQ” that can use with mysql, sqllite or other DBs
Entity Framework plug with any database server like DB2, Sybase, Oracle, SQL Azure and other.
In LINQ to SQL, inheritance is difficult.
Entity Framework is simple to apply because it supports Table per class and table per Type.
LINQ to SQL file type is DBML
Entity Framework File type is EDMX.
LINQ to SQL has DataContext object which we can query the database,
Entity Framework, we can query database using LINQ To Entities through the ObjectContext object and ESQL(provides SQL like query language). In addition, Entity Framework has ObjectQuery class(used with Object Services for dynamically constructing queries at runtime) and EntityClient provider(runs query against conceptual model).
LINQ to SQL is slow for the first time run, after first run acceptable performance.
Entity Framework is also slow for the first but performance is good then LINQ to SQL after first run.
LINQ to SQL has not capability to generate database from Model
Entity Framework has capability to generate database from Model.