Microsoft Details LINQ Overhaul in New Entity Framework Core 3.0

Entity Framework Core 3.0, which shipped on Sept. 23, includes a new LINQ implementation that Microsoft explained in an announcement post.

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.

In moving LINQ functionality to Microsoft's new, cross-platform, open source flagship Object-Relational Mapping (ORM) tool, Entity Framework Core, the dev team faced some tricky obstacles in lining everything up correctly in a series of EF Core 3.0 previews, which required some workarounds.

In yesterday's announcement of EF Core 3.0, Diego Vega, program manager for .NET Data Access, detailed the LINQ overhaul.

"We rearchitected our LINQ provider to enable translating more query patterns into SQL, generating efficient queries in more cases, and preventing inefficient queries from going undetected," Vega said. "The new LINQ provider is the foundation over which we'll be able to offer new query capabilities and performance improvements in future releases, without breaking existing applications and data providers."

Major changes included limiting client-side evaluations of queries that included LINQ expressions that couldn't be converted to parameters or translated to SQL. Those client evaluations could bog things down in big databases so their scope was restricted.

Also new is a design change that sees a single SQL statement generated for each LINQ query. The previous scheme of generating multiple SQL statements in some situations could cause problems.

Other new features detailed by Vega include:

  • Cosmos DB support
  • C# 8.0 support
  • Interception of database operations: "The new interception API in EF Core 3.0 allows providing custom logic to be invoked automatically whenever low-level database operations occur as part of the normal operation of EF Core."
  • Reverse engineering of database views: "Query types, which represent data that can be read from the database but not updated, have been renamed to keyless entity types. As they are an excellent fit for mapping database views in most scenarios, EF Core now automatically creates keyless entity types when reverse engineering database views."
  • Dependent entities sharing a table with principal are now optional: "Starting with EF Core 3.0, if OrderDetails is owned by Order or explicitly mapped to the same table, it will be possible to add an Order without an OrderDetails and all of the OrderDetails properties, except the primary key will be mapped to nullable columns."

Vega also announced the debut of Entity Framework 6.3, a holdover from the proprietary, Windows-only .NET Framework that's being subsumed in favor of the Core direction.

"We understand that many existing applications use previous versions of EF, and that porting them to EF Core only to take advantage of .NET Core can require a significant effort," he said. "For that reason, we decided to port the newest version of EF 6 to run on .NET Core 3.0."

Now the dev team is focused on completing existing documentation and working on EF Core 3.1, coming up later this year. The .NET Core platform is scheduled for v3.1 update in November.

One question still up in the air, as posed by a couple comments to Vega's post, is Universal Windows Platform (UWP) support.

"UWP would need to support .NET Standard 2.1," Vega replied. "I have tried to find out when/if this is going to happen, but didn't get a definitive answer. I will try again."

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • What's New in Visual Studio 2019 v16.5 Preview 2

    The second preview of Visual Studio 2019 v16.5 has arrived with improvements across the flagship IDE, including the core experience and different development areas such as C++, Python, web, mobile and so on.

  • C# Shows Strong in Tech Skills Reports

    Microsoft's C# programming language continues to show strong in tech industry skills reports, with the most recent examples coming from a skills testing company and a training company.

  • Color Shards

    Sharing Data and Splitting Components in Blazor

    ASP.NET Core Version 3.1 has at least two major changes that you'll want to take advantage of. Well, Peter thinks you will. Depending on your background, your response to one of them may be a resounding “meh.”

  • Architecture Small Graphic

    Microsoft Ships Preview SDK, Guidance for New Dual-Screen Mobile Era

    Microsoft announced a new SDK and developer guidance for dealing with the new dual-screen mobile era, ushered in by the advent of ultra-portable devices such as the Surface Duo.

  • How to Create a Machine Learning Decision Tree Classifier Using C#

    After earlier explaining how to compute disorder and split data in his exploration of machine learning decision tree classifiers, resident data scientist Dr. James McCaffrey of Microsoft Research now shows how to use the splitting and disorder code to create a working decision tree classifier.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events