News

Microsoft Takes Entity Framework 6 to .NET Core

Microsoft announced Entity Framework 6.3 Preview, which takes the traditional open source object-relational mapping (ORM) framework to the .NET Core space, joining Entity Framework Core as an option for leveraging the upcoming .NET Core 3.0.

The preview is another part of the company's wholesale shift to the open source, cross-platform approach provided by "Core" offerings, supplanting the traditional, 17-year-old Windows-based .NET Framework scheme.

While Entity Framework was originally part of that .NET Framework, as of Entity Framework 6 the runtime was separated from that platform. Now, with the EF 6.3 preview, Microsoft is taking the first steps to help Microsoft-centric data developers move their applications to the new Core order.

As Microsoft describes:

  • Entity Framework 6 (EF6) is a tried and tested object-relational mapper (O/RM) for .NET with many years of feature development and stabilization.
  • Entity Framework (EF) Core is a lightweight, extensible, open source and cross-platform version of the popular Entity Framework data access technology.

The company is working toward a unified offering that ties everything together under the .NET 5 moniker, due next year.

In the meantime, products are moving to .NET Core piecemeal.

"While Entity Framework Core was built from the ground up to work on .NET Core, 6.3 will be the first version of EF 6 that can run on .NET Core and work cross-platform," said Diego Vega, program manager, .NET Data Access, in a blog post last week. "In fact, the main goal of this release is to facilitate migrating existing applications that use EF 6 to .NET Core 3.0."

As a first effort in that direction, the preview has some "major limitations," Vega said, listing those as:

  • Migration commands cannot be executed on projects not targeting .NET Framework.
  • There is no EF designer support for projects not targeting .NET Framework.
  • There is no support for building and running with models based on EDMX files on .NET Core. On .NET Framework, this depends on a build task that splits and embeds the contents of the EDMX file into the final executable file, and that task is not available for .NET Core.
  • Running code first projects in .NET Core is easier but still requires additional steps, like registering DbProviderFactories programmatically, and either passing the connection string explicitly, or setting up a DbConnectionFactory in a DbConfiguration.
  • Only the SQL Server provider, based on System.Data.SqlClient, works on .NET Core. Other EF6 providers with support for .NET Core haven’t been released yet.

Regarding the EDMX-related limitation -- a concern of several developers who commented on the post -- Vega said it was a temporary limitation expected to be removed by the time the final product ships.

In response to another question, he clarified the company's positioning on the alternative offerings: "This post is about the next minor version of EF6, that now happens to also run on .NET Core. EF Core and EF6 remain two different products, and nothing else has changed."

In addition to the preview limitations detailed above, longer-term limitations listed by Vega include:

  • We have no plans to support the SQL Server Compact provider on .NET Core. There is no ADO.NET provider for SQL Server Compact on .NET Core.
  • SQL Server spatial types and HierarchyID aren’t available on .NET Core.

As Microsoft works out the kinks in the v6.3 preview, it aims to eventually support:

  • NuGet PackageReferences (this implies working smoothly without any EF entries in application config files)
  • Migration commands running on projects using the new .NET project system

Vega provided getting-started advice in his post and pointed to the project's issue tracker for further information on bug fixes and more.

The preview is available via NuGet.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • 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.

Subscribe on YouTube