{"id":24119,"date":"2019-08-13T11:29:25","date_gmt":"2019-08-13T18:29:25","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=24119"},"modified":"2019-08-22T16:55:59","modified_gmt":"2019-08-22T23:55:59","slug":"announcing-entity-framework-core-3-0-preview-8-and-entity-framework-6-3-preview-8","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-entity-framework-core-3-0-preview-8-and-entity-framework-6-3-preview-8\/","title":{"rendered":"Announcing Entity Framework Core 3.0 Preview 8 and Entity Framework 6.3 Preview 8"},"content":{"rendered":"<p>The Preview 8 versions of the\u00a0<a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.EntityFrameworkCore\/3.0.0-preview8.19405.11\">EF Core 3.0 package<\/a>\u00a0and the\u00a0<a href=\"https:\/\/www.nuget.org\/packages\/EntityFramework\/6.3.0-preview8-19405-04\">EF 6.3 package<\/a>\u00a0are now available for download from\u00a0<a href=\"https:\/\/www.nuget.org\/\">nuget.org<\/a>.<\/p>\n<p>New previews of <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-core-3-0-preview-8\/\">.NET Core 3.0<\/a> and <a href=\"https:\/\/devblogs.microsoft.com\/aspnet\/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-8\/\">ASP.NET Core 3.0<\/a> are also available today.<\/p>\n<p><strong>Please install these previews to validate that all the functionality required by your applications is available and works correctly.\u00a0<\/strong><\/p>\n<p><strong>Please report any issues you find as soon as possible to either the\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\/new\">EF Core issue tracker<\/a>\u00a0or the\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFramework6\/issues\/new\">EF 6 issue tracker<\/a>\u00a0on GitHub.<\/strong><\/p>\n<p><strong>At this point, we are especially interested in hearing about any unexpected issues blocking you from upgrading to the new releases, but you are also welcome to try new functionality and provide general feedback.<\/strong><\/p>\n<h2 id=\"what-s-new-in-ef-core-30\">What&#8217;s new in EF Core 3.0<\/h2>\n<p>Preview 8 includes\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues?q=is%3Aissue+milestone%3A3.0.0-preview8+is%3Aclosed\">fixes for 68 issues<\/a>\u00a0that we resolved since Preview 7. Here are a few highlights:<\/p>\n<ul>\n<li>Some functionality that we had temporarily disabled while working on our new LINQ implementation is now restored. For example, compiling queries explicitly is now possible, and owned entity types are once again automatically included in query results.<\/li>\n<li>Several existing and new APIs across EF Core have been tweaked as a result of API reviews.<\/li>\n<li>Numerous APIs required by providers have been made public.<\/li>\n<li>The new interception feature has been enhanced to allow intercepting\u00a0<code>DbCommand<\/code>\u00a0creation.<\/li>\n<li><code>KeyAttribute<\/code>\u00a0is now scaffolded even if EF Core won&#8217;t use it, for example for composite keys (contributed by\u00a0<a href=\"https:\/\/github.com\/ErikEJ\">Erik Ejlskov Jensen<\/a>).<\/li>\n<li>Various improvements were made to the scaffolding of comments from SQL Server database objects (also contributed by\u00a0<a href=\"https:\/\/github.com\/ErikEJ\">Erik Ejlskov Jensen<\/a>).<\/li>\n<li>Support for scaffolding of views was extended to SQLite (also contributed by\u00a0<a href=\"https:\/\/github.com\/ErikEJ\">Erik Ejlskov Jensen<\/a>).<\/li>\n<li><code>EF.Functions.IsDate()<\/code>\u00a0was added for SQL Server (contributed by\u00a0<a href=\"https:\/\/github.com\/ralmsdeveloper\">Rafael Almeida<\/a>).<\/li>\n<li>The Cosmos DB provider was upgraded to use the\u00a0<a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Azure.Cosmos\/3.0.0\">3.0 RTM version of the Azure Cosmos SDK<\/a>.<\/li>\n<li>The SQL Server provider was upgraded to a newer preview version of\u00a0<a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Data.SqlClient\/1.0.19189.1-Preview\">Microsoft.Data.SqlClient<\/a>.<\/li>\n<\/ul>\n<p>Most of the major pieces of the new EF Core LINQ implementation are now in place. However, in Preview 8 the functionality of the in-memory provider is still very limited, and global query filters are still not correctly applied to navigation properties. The fix for the latter is available in daily builds, as well as fixes for many other issues.<\/p>\n<h3><a id=\"user-content-consider-installing-daily-builds\" class=\"anchor\" href=\"https:\/\/github.com\/microsoft\/dotnet-blog\/blob\/99d0831861290ded4592c9a16a973050b96bd98f\/2019\/08-Aug\/ef-core-3-preview8\/ef-core-3-preview8.md#consider-installing-daily-builds\" aria-hidden=\"true\"><\/a>Consider installing daily builds<\/h3>\n<p>In fact,\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/milestone\/42?closed=1\">we have already fixed more than 50 issues<\/a>\u00a0that aren&#8217;t included in Preview 8, and\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues?q=is%3Aopen+is%3Aissue+milestone%3A3.0.0\">we are tracking several more<\/a>\u00a0to be fixed before RTM.<\/p>\n<p>Given that we are fixing issues very rapidly, we recommend switching to a daily build to verify the latest fixes.<\/p>\n<p>Detailed instructions to install daily builds, including the necessary NuGet feeds, can be found\u00a0in the <a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/blob\/master\/docs\/DailyBuilds.md\">How to get daily builds of ASP.NET Core<\/a> article.<\/p>\n<h3 id=\"common-workarounds-for-linq-queries\">Common workarounds for LINQ queries<\/h3>\n<p>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&#8217;s still a work in progress. For these reasons, you are likely to run into issues with LINQ queries, especially when upgrading existing applications. Here are some workarounds that might help you get things working:<\/p>\n<ul>\n<li><strong>Try a\u00a0<a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/blob\/master\/docs\/DailyBuilds.md\">daily build<\/a><\/strong> (as previously mentioned) to confirm that you aren&#8217;t hitting an issue that has already been fixed.<\/li>\n<li><strong>Switch to client evaluation explicitly:<\/strong>\u00a0If 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\u00a0<code>AsEnumerable()<\/code>,\u00a0<code>AsAsyncEnumerable()<\/code>,\u00a0<code>ToList()<\/code>, or\u00a0<code>ToListAsync()<\/code>\u00a0in the middle of the query. For example, the following query will no longer work in EF Core 3.0 because one of the predicates in the\u00a0<em>where<\/em> clause requires client evaluation:\n<div class=\"highlight highlight-source-cs\">\n<pre class=\"\">var specialCustomers = context.Customers\r\n  .Where(c =&gt; c.Name.StartsWith(n) &amp;&amp; IsSpecialCustomer(c));\r\n<\/pre>\n<\/div>\n<p>But if you know it is reasonable to process part of the filter on the client, you can rewrite the query as:<\/p>\n<div class=\"highlight highlight-source-cs\">\n<pre>\r\n   var specialCustomers = context.Customers\r\n     .Where(c =&gt; c.Name.StartsWith(n))\r\n     .AsEnumerable() \/\/ Start using LINQ to Objects (switch to client evaluation)\r\n     .Where(c =&gt; IsSpecialCustomer(c));\r\n<\/pre>\n<\/div>\n<p>Remember that this is by-design: In EF Core 3.0,\u00a0<a href=\"https:\/\/docs.microsoft.com\/ef\/core\/what-is-new\/ef-core-3.0\/breaking-changes#linq-queries-are-no-longer-evaluated-on-the-client\">LINQ operations that cannot be translated to SQL are no longer automatically evaluated on the client<\/a>.<\/li>\n<li><strong>Use raw SQL queries:<\/strong>\u00a0If 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\u00a0<code>FromSqlRaw()<\/code>\u00a0or\u00a0<code>FromSqlInterpolated()<\/code>\u00a0methods.Also make sure an issue exists in\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\">our issue tracker on GitHub<\/a>\u00a0to support the translation of the specific expression.<\/li>\n<\/ul>\n<h3 id=\"breaking-changes\">Breaking changes<\/h3>\n<p>All breaking changes in this release are\u00a0listed in the <a href=\"https:\/\/docs.microsoft.com\/ef\/core\/what-is-new\/ef-core-3.0\/breaking-changes\">Breaking Changes in EF Core 3.0<\/a> article. We keep the list up to date on every preview, with the most impactful changes near the top of the list, to make it easier for you to react.<\/p>\n<h3 id=\"obtaining-the-preview-8-packages\">Obtaining the Preview 8 packages<\/h3>\n<p>EF Core 3.0 is distributed exclusively as NuGet packages. As usual, add or upgrade the runtime to preview 8 via the NuGet user interface, the Package Manager Console in Visual Studio, or via the\u00a0<code>dotnet add package<\/code> command. In all cases, include the option to allow installing pre-release versions. For example, you can execute the following command to install the SQL Server provider:<\/p>\n<div class=\"highlight highlight-text-shell-session\">\n<pre>dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 3.0.0-*\r\n<\/pre>\n<\/div>\n<p>With .NET Core 3.0, the\u00a0<code>dotnet ef<\/code>\u00a0command-line tool is no longer included in the .NET Core SDK. Before you can execute EF Core migration or scaffolding commands, you&#8217;ll have to install it as either a global or local tool. Due to limitations in\u00a0<code>dotnet tool install<\/code>, installing preview tools requires specifying at least part of the preview version on the installation command. For example, to install the 3.0 Preview 8 version of\u00a0<code>dotnet ef<\/code>\u00a0as a global tool, execute the following command:<\/p>\n<div class=\"highlight highlight-text-shell-session\">\n<pre>dotnet tool install --global dotnet-ef --version 3.0.0-*\r\n<\/pre>\n<\/div>\n<h2 id=\"whats-new-in-ef-63-preview-8\">What&#8217;s new in EF 6.3 Preview 8<\/h2>\n<p>With the added ability to execute migration commands against .NET Core projects in Visual Studio, most of the work planned for the EF 6.3 package has been completed. We are now focused on fixing any bugs that arise.<\/p>\n<p>As with EF Core, any bug fixes that happened after we branched for Preview 8 are available in\u00a0<a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/blob\/master\/docs\/DailyBuilds.md\">our daily builds<\/a>.<\/p>\n<h3 id=\"how-to-work-with-edmx-files-in-net-core-projects\">How to work with EDMX files in .NET Core projects<\/h3>\n<p>On the tooling side, we plan to release an updated EF6 designer in an upcoming update of Visual Studio 2019 which will work with projects that target .NET Core (tracked in issue\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFramework6\/issues\/883\">#883<\/a>).<\/p>\n<p>Until this new version of the designer is available, we recommend that you work with your EDMX files inside projects that target .NET Framework. You can then add the EDMX file and the generated classes for the entities and the <code>DbContext<\/code> to the .NET Core 3.0 or .NET Standard 2.1 project as linked files. For example, the project file for the .NET Core project can include the linked files like this:<\/p>\n<div class=\"highlight highlight-source-xml\">\n<pre>\r\n  <ItemGroup>\r\n    <EntityDeploy Include=\"..\\EdmxDesignHost\\Entities.edmx\" Link=\"Model\\Entities.edmx\" \/>\r\n    <Compile Include=\"..\\EdmxDesignHost\\Entities.Context.cs\" Link=\"Model\\Entities.Context.cs\" \/>\r\n    <Compile Include=\"..\\EdmxDesignHost\\Thing.cs\" Link=\"Model\\Thing.cs\" \/>\r\n    <Compile Include=\"..\\EdmxDesignHost\\Person.cs\" Link=\"Model\\Person.cs\" \/>\r\n  <\/ItemGroup>\r\n<\/pre>\n<\/div>\n<p>Note that the EDMX file is linked with the <code>EntityDeploy<\/code> build action. This is a special MSBuild task (now included in the EF 6.3 package) that takes care of adding the EF model into the target assembly as embedded resources (or copying it as files in the output folder, depending on the setting on the Metadata Artifact Processing setting in the EDMX). For more details on how to get this set up, see our <a href=\"https:\/\/aka.ms\/EdmxDotNetCoreSample\">EDMX .NET Core sample<\/a>. <\/p>\n<p>You can choose to copy the files instead of linking them, but keep in mind that due to a bug in current builds of Visual Studio, copying the files from the .NET Framework project to the .NET Core project within Solution Explorer may cause hangs, so it is better to copy the files from the command line. <\/p>\n<h3 id=\"feedback-requested-should-we-build-a-dotnet-ef6-tool\">Feedback requested: Should we build a dotnet ef6 tool?<\/h3>\n<p>We are also seeking feedback and possible contributions to enable a cross-platform command line experience for migrations commands, similar to\u00a0<code>dotnet ef<\/code>\u00a0but for EF6 (tracked in issue\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFramework6\/issues\/1053\">#1053<\/a>). If you would like to see this happen, or if you would like to contribute to it, please vote or comment on the issue.<\/p>\n<h2 id=\"weekly-status-updates\">Weekly status updates<\/h2>\n<p>If you&#8217;d like to track our progress more closely, we now publish weekly status updates to\u00a0<a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\/15403\">GitHub<\/a>. We also post these status updates to our Twitter account,\u00a0<a href=\"https:\/\/twitter.com\/efmagicunicorns\">@efmagicunicorns<\/a>.<\/p>\n<h2 id=\"thank-you\">Thank you<\/h2>\n<p>As usual, thank you for trying our preview bits, and for all the bug reports and contributions that will help make EF Core 3.0 and EF 6.3 much better releases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Preview 8 versions of the\u00a0EF Core 3.0 package\u00a0and the\u00a0EF 6.3 package\u00a0are now available for download from\u00a0nuget.org. New previews of .NET Core 3.0 and ASP.NET Core 3.0 are also available today. Please install these previews to validate that all the functionality required by your applications is available and works correctly.\u00a0 Please report any issues you [&hellip;]<\/p>\n","protected":false},"author":912,"featured_media":21744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[859],"tags":[9,32,70,71],"class_list":["post-24119","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-entity-framework","tag-net-core","tag-asp-net-core","tag-entity-framework","tag-entity-framework-core"],"acf":[],"blog_post_summary":"<p>The Preview 8 versions of the\u00a0EF Core 3.0 package\u00a0and the\u00a0EF 6.3 package\u00a0are now available for download from\u00a0nuget.org. New previews of .NET Core 3.0 and ASP.NET Core 3.0 are also available today. Please install these previews to validate that all the functionality required by your applications is available and works correctly.\u00a0 Please report any issues you [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/912"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=24119"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24119\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/21744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=24119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=24119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=24119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}