Microsoft Updates Entity Framework, Even as EF Core Ascends
Microsoft shipped a new runtime release of the nine-year-old Entity Framework object/relational mapper (O/RM) even as it cedes mindshare to the newer, lightweight, open source and cross-platform version, Entity Framework Core.
While the Entity Framework 6.2 runtime has been released, associated tools for it weren't shipped but are on the way.
Since the days of Visual Studio 2008 and .NET Framework 3.5 in 2008, Entity Framework has served as the primary data-access technology for the .NET ecosystem.
Still enjoying tremendous popularity, it was last year described by Microsoft as the most popular package listed by NuGet.org, overseer of the NugGet package manager.
In fact, if you go to the Packages page of that site right now, it appears in the No. 3 slot (out of 95,345 packages), having been downloaded more than 35 million times.
However, as Microsoft moves much of its developer tooling and associated frameworks to lighter, more accessible, cross-platform "x.Core" versions, the EF Core project (Microsoft.EntityFrameworkCore 2.0 on NuGet; aspnet/EntityFrameworkCore on GitHub) is getting more attention.
This younger cousin is a rewritten version of the traditional Entity Framework that supports the new .NET Standard 2.0 for consistent API usage across all .NET implementations. EF Core 2.0 -- while introducing many new improvements and features over EF 6 -- shows its immaturity in its lack of some other EF 6 capabilities that .NET programmers have long gotten used to.
For example, while EF Core provides new features -- such as alternate keys and mixed client/database evaluation in LINQ queries -- that Microsoft said wouldn't be implemented in EF 6, it also lacks EF 6 features such as lazy loading, connection resiliency, server-side GroupBy query support and others.
Some missing capabilities are targeted for future versions, such as the EF Core 2.1 release expected in the first quarter of next year.
Meanwhile, Microsoft continues to support the EF 6 project, just yesterday releasing the EF 6.2 runtime.
"While most of the focus of the EF team is nowadays on adding new features and improvements to EF Core, we plan to keep fixing important bugs, implementing small improvements, and incorporating community contributions in the EF 6 codebase," said project chief Diego B Vega in a blog post. "To a great extent, it is thanks to the efforts [of] our community of open source contributors that EF 6.2 includes numerous bugs fixes and product enhancements."
Vega said the most important changes, including bug fixes, are:
- Reduce start up time by loading finished code first models from a persistent cache #275
- Fluent API to define indexes #274
- DbFunctions.Like() to enable writing LINQ queries that translate to LIKE in SQL #241
- Migrate.exe should support -script option #240
- EF6 does not work with primary key from sequence #165
- Update error numbers for SQL Azure Execution Strategy #83
- Bug: Retrying queries or SQL commands fails with "The SqlParameter is already contained by another SqlParameterCollection" #81
- Bug: Evaluation of DbQuery.ToString() frequently times out in the debugger #73
One of those community contributors thanked by Vega is Erik Ejlskov Jensen, who Vega said has taken over the EF Power Tools project with a "Community Edition" fork. EF Tools provide design-time utilities for EF 6 that can be invoked via the Visual Studio Solution Explorer context menu -- for example, by right-clicking in code files to view an underlying Entity Data Model, generate views and so on. The GitHub project for the new community EF 6 Power Tools shows 36 stars and 49 contributors.
Speaking of tools, Vega said that while the EF 6.2 runtime packages have been released, the associated tools aren't quite ready for prime time, needing work to address outstanding issues. The tools will be provided automatically in a future Visual Studio 2017 upgrade and will be available via downloadable installers for previous versions of Visual Studio.
Along with the upcoming EF 6.2 tools, Vega said other future work involves porting the EF 6 documentation to the Microsoft Docs platform and improving support for NuGet's PackageReference.
Meanwhile, work is continuing on EF Core. Vega has published a roadmap of the project and has shed light on the project's Release Planning Process.
Until the EF Core project gets features such as lazy loading and GroupBy in v2.1 early next year, however, many developers will stay clear.
David Ramel is the editor of Visual Studio Magazine.