比較 EF Core 與 EF6Compare EF Core & EF6

Entity Framework 分為 Entity Framework Core 及 Entity Framework 6 兩種版本。There are two different versions of Entity Framework, Entity Framework Core and Entity Framework 6.

Entity Framework 6Entity Framework 6

Entity Framework 6 (EF6) 是已經過試用並測試的資料存取技術,具有多年的功能和穩定性。Entity Framework 6 (EF6) is a tried and tested data access technology with many years of features and stabilization. 它是在 2008 年當成 .NET Framework 3.5 SP1 和 Visual Studio 2008 SP1 的一部分第一次發行。It first released in 2008, as part of .NET Framework 3.5 SP1 and Visual Studio 2008 SP1. 從 EF4.1 版開始,它會出貨為 EntityFramework NuGet 套件,這目前是 NuGet.org 上的其中一個最常見套件。Starting with the EF4.1 release it has shipped as the EntityFramework NuGet package - currently one of the most popular packages on NuGet.org.

EF6 仍然是受支援的產品,在未來的某個時間仍會看到 Bug 修正和小幅度的改善。EF6 continues to be a supported product, and will continue to see bug fixes and minor improvements for some time to come.

Entity Framework CoreEntity Framework Core

Entity Framework Core (EF Core) 是 Entity Framework 的輕量型、可擴充且跨平台版本。Entity Framework Core (EF Core) is a lightweight, extensible, and cross-platform version of Entity Framework. 與 EF6 相較之下,EF Core 引進許多改善和新功能。EF Core introduces many improvements and new features when compared with EF6. 同時,EF Core 是新的程式碼基底,不像 EF6 一樣成熟。At the same time, EF Core is a new code base and not as mature as EF6.

EF Core 保有 EF6 的開發人員體驗,而且大部分的最上層 API 也都相同;因此,使用 EF6 的人員會覺得 EF Core 十分熟悉。EF Core keeps the developer experience from EF6, and most of the top-level APIs remain the same too, so EF Core will feel very familiar to folks who have used EF6. 同時,EF Core 是透過一組全新的核心元件所建置。At the same time, EF Core is built over a completely new set of core components. 這表示 EF Core 不會自動繼承 EF6 的所有功能。This means EF Core doesn't automatically inherit all the features from EF6. 這些功能中有一些會繼續在未來的版本中出現,但有一些比較不常用的功能將不會出現在 EF Core 中。While some of these features will show up in future releases, other less commonly used features will not be implemented in EF Core.

我們也可透過這款可擴充輕量型新核心,為 EF Core 新增一些 EF6 沒有的功能 (例如替代鍵、批次更新,以及 LINQ 查詢中的混合用戶端/資料庫評估)。The new, extensible, and lightweight core has also allowed us to add some features to EF Core that will not be implemented in EF6 (such as alternate keys, batch updates, and mixed client/database evaluation in LINQ queries).