News

Entity Framework Core 3.0 Finalized, LINQ Workarounds Published

As with other "Core 3.0" products, Entity Framework is basically done at this point as the big final release is less than two weeks away, and Microsoft has provided some workarounds for the problematic LINQ implementation in the new and final preview.

Microsoft said "We have almost completely stopped making changes to the product code" in announcing EF Core 3.0 Preview 9, but it's seeking feedback on any bugs that developers can find, even if they can't be fixed in time for .NET Core 3.0 shipping during the Sept. 23-25 online .NET Conf event.

Some of those bugs might have to do with LINQ, with which the EF dev team has struggled in the move to .NET Core 3.0.

LINQ (Language Integrated Query) uses C# code to query various types of data stores, providing IntelliSense, strong typing and other benefits in an alternative to SQL queries.

The problematic .NET Core 3.0 porting was explained last month in the release of Preview 8. "The LINQ implementation in EF Core 3.0 is designed to work very differently from the one used in previous versions of EF Core, and in some areas, it's still a work in progress," said program manager Diego Vega in an Aug. 13 announcement post. "For these reasons, you are likely to run into issues with LINQ queries, especially when upgrading existing applications."

With EF Core 3.0 basically finalized, Microsoft last week published some workaround advice:

  • Try a daily build to confirm that you aren't hitting an issue that has already been fixed.
  • Switch to client evaluation explicitly: If your query filters data based on an expression that cannot be translated to SQL, you may need to switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync() in the middle of the query.
  • Use raw SQL queries: If some expression in your LINQ query is not translated correctly (or at all) to SQL, but you know what translation you would want to have generated, you may be able to work around the issue by executing your own SQL statement using the FromSqlRaw() or FromSqlInterpolated() methods.

Along with EF Core 3.0 Preview 9, Microsoft also shipped Entity Framework 6.3 Preview 9, a holdover from the traditional, proprietary, aging and Windows-only.NET Framework that is now an independent offering. As the company explains the difference between the two:

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

Any bugs found can be reported to either the EF Core issue tracker or the EF 6 issue tracker on GitHub.

The EF dev team publishes weekly status updates on its progress on GitHub.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Death of the Dev Machine?

    Here's a takeaway from this week's Ignite 2020 event: An advanced Azure cloud portends the death of the traditional, high-powered dev machine packed with computing, memory and storage components.

  • COVID-19 Is Ignite 2020's Elephant in the Room: 'Frankly, It Sucks'

    As in all things of our new reality, there was no escaping the drastic changes in routine caused by the COVID-19 pandemic during Microsoft's big Ignite 2020 developer/IT pro conference, this week shifted to an online-only event after drawing tens of thousands of in-person attendees in years past.

  • Visual Studio 2019 v16.8 Preview Update Adds Codespaces

    To coincide with the Microsoft Ignite 2020 IT pro/developer event, the Visual Studio dev team shipped a new update, Visual Studio 2019 v16.8 Preview 3.1, with the main attraction being support for cloud-hosted Codespaces, now in a limited beta.

  • Speed Lines Graphic

    New for Blazor: Azure Static Web Apps Support

    With Blazor taking the .NET web development world by storm, one of the first announcements during Microsoft's Ignite 2020 developer/IT event was its new support in Azure Static Web Apps.

  • Entity Framework Core 5 RC1 Is Feature Complete, Ready for Production

    The first release candidate for Entity Framework 5 -- Microsoft's object-database mapper for .NET -- has shipped with a go live license, ready for production.

Upcoming Events