News

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

Featured

  • Visual Studio Code Dev Team Cleans Up

    The Visual Studio Code development team focused on some housekeeping in the October update, closing more than 4,000 issues on GitHub, where the cross-platform, open-source editor lives.

  • ML.NET Model Builder Update Boosts Image Classification

    Microsoft announced an update to the Model Builder component of its ML.NET machine learning framework, boosting image classification and adding "try your model" functionality for predictions with sample input.

  • How to Do Naive Bayes with Numeric Data Using C#

    Dr. James McCaffrey of Microsoft Research uses a full code sample and screenshots to demonstrate how to create a naive Bayes classification system when the predictor values are numeric, using the C# language without any special code libraries.

  • Vortex

    Open Source 'Infrastructure-as-Code' SDK Adds .NET Core Support for Working with Azure

    Pulumi, known for its "Infrastructure-as-Code" cloud development tooling, has added support for .NET Core, letting .NET-centric developers use C#, F# and VB.NET to create, deploy, and manage Azure infrastructure.

  • .NET Framework Not Forgotten: Repair Tool Updated

    Even though Microsoft's development focus has shifted to the open-source, cross-platform .NET Core initiative -- with the aging, traditional, Windows-only .NET Framework relegated primarily to fixes and maintenance such as quality and reliability improvements -- the latter is still getting some other attention, as exemplified in a repair tool update.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events