News

Entity Framework 6.2 Emerges Out of Preview

This more fully-fledged version of Microsoft's object relational/mapper is now at the initial beta testing stage, with quicker startups and a number of fixes from the preview, but there's also more work to do to resolve some issues that can impact EF providers. Also: a list of new features of the EF Core 2.0 preview released at Build.

A version of the Entity Framework runtime has emerged out of preview, and it's now in the initial beta stage. Dubbed EF 6.2 Beta 1, it comes with a number of fixes for issues that surfaced in the preview, and it's now faster at startup. But there is some work to do, and the .NET team is looking for help to resolve some issues impacting EF providers.

"We suspect some of the existing EF providers could be negatively impacted by a fix included in our tooling in this release, and we are asking for help from provider writers to validate this hypothesis," wrote Diego Vega, a program manager with Microsoft's EF team, in a blog post.

"The fix addresses a long-standing problem with schema discovery queries used in the 'Update model from database' feature of the EF tools," he explained. "When using the feature against a database with a large number of objects, the schema discovery queries can contain large numbers of parameters." He noted that SQL Server is limited of 2,100 parameters per query, and failures can occur with models that contain more than 300 objects because of the complexity with how queries and parameters are generated. So, the workaround, he said was to reduce "the number of parameters required by schema discovery queries by reusing parameter objects for each distinct value." A more detailed explanation of the fix is in this pull request on GitHub.

Vega noted that the fix was implemented in shared code and applied to all providers, but because of the way some providers "implement schema discovery by matching patterns in the schema discovery queries and then translating those patterns into calls to their native schema discovery API calls," the fix might actually break with some of those providers.

It's worth noting that Entity Framework continues to be enhanced and improved, even though the runtime is being superseded in future versions of Visual Studio with Entity Framework Core. EF Core is currently at version 1.0, with a version 2.0 preview made available at Build earlier this month. As such, EF 6.2 Beta 1 consists mainly of improvements and fixes, of which these ones were highlighted in Vega's blog:

  • Reduce start up time by loading finished code first models from a persistent cache
  • Fluent API to define indexes
  • EF tools Update Model issue when provider reports nullable keys
  • Add DbFunctions.Like() to enable writing LINQ queries that translate to LIKE in SQL
  • Migrate.exe should support -script option
  • Updating large models from database can make sp_executesql fail with too many parameters

The blog post also provides guidance on downgrading back to the originally installed EF tooling install, should developers run into issues using this initial beta.

The beta release of EF 6.2 runtime follows a preview release of EF Core 2.0 that was let loose at Build a few weeks ago. Microsoft describes EF Core as a "lightweight, extensible, and cross-platform version" of EF. Among the improvements to this version:

  • Enhanced LINQ translations and query execution
  • Addition of EF.Functions property that EF Core or providers can use "to define methods that map to database functions or operators so that those can be invoked in LINQ queries"
  • Types can be mapped even though they might not "posses their own identity and for which instances can only be tracked and referenced as dependents of instances of other entity types"
  • Global query filters
  • DbContext pooling
  • Manual compiled queries are more performant

Details of each of these features are contained in this blog post.

About the Author

Michael Domingo is a long-time software publishing veteran, having started up and managed several developer publications for the Clipper compiler, Microsoft Access, and Visual Basic. He's also managed IT pubs for 1105 Media, including Microsoft Certified Professional Magazine and Virtualization Review before landing his current gig as Visual Studio Magazine Editor in Chief. Besides his publishing life, he's a professional photographer, whose work can be found by Googling domingophoto.

comments powered by Disqus

Featured

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

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube