Speed O/R Mapping with LINQ to SQL: Table 1: Compare LINQ to SQL and Entity Framework.

LINQ to SQL and Entity Framework (EF) are both object/relational mapping (O/RM) tools for .NET, so it's not surprising that they share many common features. This table compares the most significant differences between the two O/RM implementations, including times to instantiate a LINQ to SQL DataContext and EF ObjectContext of a 120-table SQL Server 2005 structure-only database. The EF team is in the process of designing EF/Entity Data Model version 2; there's been no official mention of a version upgrade for LINQ to SQL.
Feature LINQ to SQL Entity Framework/Entity Data Model
Supported databases SQL Server 200x (Express, Compact) only SQL Server 200x (Express, Compact) and other relational databases with an EF-enabled ADO.NET managed data provider
Data model 1:1 relationship enforced between tables and entities Tables can be mapped to multiple entities and vice versa
Model-first design Not available Not available (promised in version 2)
Update Model for Data Store Schema Changes Requires third-party add-in utility Supported
Plain Old CLR Object (POCO) classes Optional (by mapping file) By unsupported code generator
N-tier deployment Not out-of-the-box By unsupported code modifications
DataContract serialization of cyclic object graphs Requires unsupported Text Template Transformation Toolkit (T4) code-generator template Supported
Inheritance models Table per Hierarchy (TPH) only TPH, Table per Class (TPC), and Table per Concrete Class (TPCC)
Association loading methods Deferred/lazy (default) and eager Eager (optional), deferred by unsupported code modifications
Many-to-many relationships Not supported (require a relation table) Supported (don't require a relation table)
Foreign-key values Visible Not visible (visible promised in version 2)
Query language(s) LINQ to SQL, direct execution LINQ to Entities, Entity SQL, query builder methods
Stored procedure support CRUD sprocs supported in the designer T-SQL CRUD sprocs supported in the designer; other DBs unknown
DAL for ADO.NET Data Services ("Astoria") Read-only (without implementing IUpdatable<T>) Default DAL (full read/write support)
DAL for ASP.NET Dynamic Data Default DAL (full read/write support) Requires a workaround
Generate a 120-table model in the designer 22 seconds 50 seconds
120-table startup time (cold) 0.394 second 9.426 seconds
120-table startup time, T4 compiled view (cold) N/A 2.063 seconds
120-table startup time (cached) 0.004 second 0.021 second
EntityType name singularization Automatic (optional) Manual
EntitySet name pluralization Automatic (optional) "Set" prefix added if EntityType name is manually singularized (English-only, forced, not optional)
Support for new SQL Server 2008 data types Date, Time, DateTime2, DateTimeOffset, Filestream Date, Time, DateTime2, DateTimeOffset, Filestream
comments powered by Disqus


.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events