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

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube