Linq to sql vs entity framework jinal desai

5,871 views
5,642 views

Published on

Entity Framework is ORM(Object Relational Mapping) introduced by Microsoft. It proves very useful for new developers for it’s simplicity to query against conceptual schema and also has rich feature set. Many time the question has been asked in the interview to explain differences between Entity Framework and LINQ To SQL to the developers who has work experience in Entity Framework. I have made table of differences between these two technologies.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,871
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
77
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Linq to sql vs entity framework jinal desai

  1. 1. Articles from Jinal DesaiLINQ To SQL Vs Entity Framework2012-05-19 17:05:50 Jinal DesaiEntity Framework is ORM(Object Relational Mapping) introduced by Microsoft. It proves very useful fornew developers for it’s simplicity to query against conceptual schema and also has rich feature set. Manytime the question has been asked in the interview to explain differences between Entity Framework andLINQ To SQL to the developers who has work experience in Entity Framework. I have made table ofdifferences between these two technologies. Parameter LINQ To SQL Entity Framework LINQ To SQL supports only Microsoft SQL Server 2000 With Entity Framework you can plug any DB Server i.e.DB Server and later version and even IBM DB2, Sybase SqlAnyWhere, Oracle, SQL Azure, and SQL Server 2000 has some lot more. limitations. In LINQ To SQL inheritance In Entity Framework inheritance is simple to apply. It is difficult to apply. It supports supports Table Per Class Hierarchy(TPH) and Table PerInheritance Table Per Class Type(TPT). It also provides limited support of Table Per Hierarchy(TPH). Concrete Class(TPC).ComplexType(Nonscalar property LINQ To SQL does notof an entity support the creation of Entity Framework support the creation of complex types.type that does complex types.not have a keyproperty)Support LINQ To SQL is easier to Entity Framework is more complex compared to LINQ ToComplexity use. SQL. Entity Framework enable decoupling DB LINQ To SQL provides one- Server(Database Schema) and Entity Representaion inModel to-one mapping of tables to terms of Model(Conceptual Schema). You can map one classes. table to multiple entities or multiple table to one entity. LINQ To SQL is simple to learn and implement for Entity Framework has more features which will take timeDevelopment Rapid Application to learn and implement, but it will work in complexTime Development, but it will not applications. work in complex applications. In LINQ To SQL each table is mapped to single class. Join table must be represented asMapping Type a class. Also, complex types In Entity Framework a class can map to multiple tables. cannot be easily represented without creating separate table. It uses Database Markup Language(DBML) file that Entity Framework uses four files EDMX, CSDL, SSDLFile Type contains XML mappings of and MSL. The later three are generated at runtime. entities to tables. With the Entity Framework, we can query database using LINQ To Entities through the ObjectContext object and LINQ To SQL has ESQL(provides SQL like query language). In addition,Query DataContext object through Entity Framework has ObjectQuery class(used with
  2. 2. Entity Framework has ObjectQuery class(used withCapability which we can query the Object Services for dynamically constructing queries at database. runtime) and EntityClient provider(runs query against conceptual model). LINQ To SQL is slow for the Entity Framework is also slow for the first run, but after first time run. After first runPerformance first run provides slightly better performance compared to provides acceptable LINQ To SQL. performance. Microsoft intended to obsolete LINQ To SQL afterFuture the Entity Framework Entity Framework has future enhacements.Enhancement releases. So it will not receive any future enhancements.Generate It has no capability to Entity Framework supports generation of database fromDatabase from generate database from Model.Model Model. Blog this! Bookmark on Delicious Digg this post Recommend on Facebook Share on FriendFeed Share on Linkedin Share on Orkut share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments on this post

×