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 at Converge 360.

comments powered by Disqus

Featured

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events