{"id":23590,"date":"2019-06-13T13:35:52","date_gmt":"2019-06-13T20:35:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=23590"},"modified":"2019-06-14T10:21:25","modified_gmt":"2019-06-14T17:21:25","slug":"announcing-entity-framework-core-3-0-preview-6-and-entity-framework-6-3-preview-6","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-entity-framework-core-3-0-preview-6-and-entity-framework-6-3-preview-6\/","title":{"rendered":"Announcing Entity Framework Core 3.0 Preview 6 and Entity Framework 6.3 Preview 6"},"content":{"rendered":"<p>New previews of the next versions of <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.EntityFrameworkCore.SqlServer\/3.0.0-preview6.19304.10\">EF Core<\/a> and <a href=\"https:\/\/www.nuget.org\/packages\/EntityFramework\/6.3.0-preview6-19304-03\">EF 6<\/a> are now available on <a href=\"https:\/\/www.nuget.org\/\">NuGet.Org<\/a>.<\/p>\n<h2 id=\"what-is-new-in-ef-core-30-preview-6\">What is new in EF Core 3.0 Preview 6<\/h2>\n<p>In recent months, a lot of our efforts have been focused on a new LINQ implementation for EF Core 3.0. Although the work isn&#8217;t complete and a lot of the intended functionality hasn&#8217;t been enabled, before preview 6 we reached a point in which we couldn&#8217;t make much more progress without integrating the new implementation into the codebase in the main branch.<\/p>\n<h3 id=\"query-changes\">Query changes<\/h3>\n<blockquote><p><strong>IMPORTANT: Although as always, we want to encourage you to experiment with our preview bits in a controlled environment and to provide feedback, preview 6 has significant limitations in the LINQ implementation that we expect to affect any application that performs all but the most trivial queries. Given this, we want to explicitly recommend you against trying to update any applications you have in production to this preview.<\/strong><\/p><\/blockquote>\n<p>While some of the limitations are caused by intentional breaking changes, a lot more are temporary issues we expect to fix before RTM.<\/p>\n<p>These are some of the main things to know:<\/p>\n<ul>\n<li><strong>Temporary limitation: In-memory database and Cosmos DB providers aren&#8217;t functional in this preview:<\/strong> In the initial phase of the switch to the new implementation, we have prioritized getting our relational providers working. Functionality with in-memory database and Cosmos DB providers is broken, and we recommend you skip preview 6 if you have code that depends on these providers. We expect to gradually restore functionality in subsequent previews.<\/li>\n<li><strong>Temporary limitation: Several areas of query translation aren&#8217;t working with relational databases:<\/strong> Queries that use any of these constructs will very likely fail to translate correctly or execute:\n<ul>\n<li>Owned types<\/li>\n<li>Collections reference on projections<\/li>\n<li>GroupBy operator<\/li>\n<li>Equality comparisons between entities<\/li>\n<li>Query tags<\/li>\n<li>Global query filters<\/li>\n<\/ul>\n<\/li>\n<li><strong>Intentional breaking change: LINQ queries are no longer evaluated on the client:<\/strong> This is actually one of the main motivations we had for building a new LINQ implementation into EF Core 3.0. Before this version of EF Core, expressions in the query that could not be translated for SQL would be automatically evaluated on the client, regardless of their location in the query. This contributed to hard to predict performance issues, especially when expressions used in predicates were not translated and large amounts of data ended up being filtered on the client, and also caused compatibility problems every time we introduced new translation capabilities. In the new implementation, we only support evaluating on the client expressions in the top-level projection of the query. Read <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\">the full description of this breaking change<\/a> in our documentation.<\/li>\n<li><strong>Intentional breaking change: Existing FromSql overloads has been renamed to FromSqlRaw and FromSqlInterpolated, and can only be used at the root of queries:<\/strong> Read <a href=\"https:\/\/docs.microsoft.com\/ef\/core\/what-is-new\/ef-core-3.0\/breaking-changes#fromsql-executesql-and-executesqlasync-have-been-renamed\">more details about it<\/a> in the breaking change documentation.<\/li>\n<\/ul>\n<p>If you run into any issues that you don&#8217;t see in this list or in the <a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/milestone\/42\">list of bugs already tracked for 3.0<\/a>, please <a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\/new\">report it on GitHub<\/a>.<\/p>\n<p>If you hit limitations only in a few queries, here are some workarounds that you might be able to use to get things working:<\/p>\n<ul>\n<li>Switch explicitly to client evaluation if you need to filter data based on an expression that cannot be translated to SQL, using the <code>AsEnumerable()<\/code> or <code>ToList()<\/code> extension methods. For example, the following query will no longer work in EF Core 3.0 because one of the predicates in the where clause requires client evaluation:\n<pre><code class=\"language-csharp\">\r\nvar specialCustomers = context.Customers\r\n  .Where(c =&gt; c.Name.StartsWith(n) &amp;&amp; IsSpecialCustomer(c));\r\n<\/code><\/pre>\n<p>But if you know it is ok to perform part of the filtering on the client, you can rewrite this as:<\/p>\n<pre class=\"\"><code class=\"language-csharp\">\r\nvar specialCustomers = context.Customers\r\n  .Where(c =&gt; c.Name.StartsWith(n))\r\n  .AsEnumerable()\r\n  .Where(c =&gt; IsSpecialCustomer(c));\r\n<\/code><\/pre>\n<\/li>\n<li>Use the new <code>FromSqlRaw()<\/code> or <code>FromSqlInterpolated()<\/code> methods to provide your own SQL translations for anything that isn&#8217;t yet supported.<\/li>\n<li>Skip preview 6 and stay on preview 5 until more issues are fixed, or try our <a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/blob\/master\/docs\/DailyBuilds.md\">nightly builds<\/a>.<\/li>\n<\/ul>\n<h3 id=\"switch-to-microsoftdatasqlclient\">Switch to Microsoft.Data.SqlClient<\/h3>\n<p>As <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-the-new-microsoftdatasqlclient\/\">announced recently<\/a>, development of the <a href=\"http:\/\/ADO.NET\">ADO.NET<\/a> provider for SQL Server has moved to this new package. The EF Core provider for SQL Server now uses the new package to connect to SQL Server databases.<\/p>\n<p>Please continue to create issues for the EF Core layer (for example SQL generation) on the <a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\">EF Core issue tracker<\/a>. Any issues related to SQL Server database connectivity are better reported to the <a href=\"https:\/\/github.com\/dotnet\/SqlClient\/issues\">SqlClient issue tracker<\/a>.<\/p>\n<h3 id=\"dbcontext-scaffolding-improvements\">DbContext scaffolding improvements<\/h3>\n<p>We now have support for:<\/p>\n<ul>\n<li>Scaffolding entities without keys.<\/li>\n<li>Scaffolding entities from database views.<\/li>\n<li>Scaffolding <code>DbContext<\/code> from an Azure SQL Data Warehouse.<\/li>\n<li>A new <code>dotnet ef dbcontext script<\/code> command to generate the SQL script equivalent to calling <code>EnsureCreated()<\/code>.<\/li>\n<li>New Package Manager Console command functionality in <code>Get-DbContext<\/code> for listing <code>DbContext<\/code> types available in an application.<\/li>\n<\/ul>\n<p>Thank you very much <a href=\"https:\/\/github.com\/ErikEJ\">@ErickEJ<\/a> for all these contributions! You rock!<\/p>\n<h2 id=\"whats-new-in-ef-63-preview-6\">What&#8217;s new in EF 6.3 Preview 6<\/h2>\n<p>Here are some of the main changes since preview 5:<\/p>\n<ul>\n<li><strong>We automatically locate System.Data.SqlClient when it isn\u2019t registered with DbProviderFactories:<\/strong> This means it&#8217;s no longer necessary to register SqlClient as a workaround before you start using EF.<\/li>\n<li><strong>EF 6 tests are passing on .NET Core:<\/strong> We made infrastructure updates necessary to get our existing tests running on .NET Core. This has allowed us to identify and fix problems in the product code as well as an issue that was fixed in .NET Core 3.0 Preview 6. There is a known issue with the translation of String methods like StartsWith, EndsWith and Contains that wasn&#8217;t fixed on time for Preview 6.<\/li>\n<\/ul>\n<h2 id=\"whats-next\">What&#8217;s next<\/h2>\n<p>For upcoming previews and the rest of the EF Core 3.0 release, our main focus will be on restoring and improving the query functionality using our new LINQ implementation.<\/p>\n<p>We are also working to enable more aspects of the experience you would expect from using EF 6.3 on .NET Core. For example, we are making additional changes to simplify working when an application .config file isn&#8217;t present, enabling embedding metadata from an EDMX into the compilation output on .NET Core, and reimplementing the EF migration commands in a way that is compatible with .NET Core.<\/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 <a href=\"https:\/\/github.com\/aspnet\/EntityFrameworkCore\/issues\/15403\">GitHub<\/a>. We also post these status updates to our Twitter account, <a href=\"https:\/\/twitter.com\/efmagicunicorns\">@efmagicunicorns<\/a>.<\/p>\n<h2 id=\"thank-you\">Thank you<\/h2>\n<p>As always, thank you for trying our preview bits, and thanks to all the contributors that helped in this preview!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>New previews of the next versions of EF Core and EF 6 are now available on NuGet.Org. What is new in EF Core 3.0 Preview 6 In recent months, a lot of our efforts have been focused on a new LINQ implementation for EF Core 3.0. Although the work isn&#8217;t complete and a lot of [&hellip;]<\/p>\n","protected":false},"author":912,"featured_media":21785,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[859],"tags":[4,9,70,71],"class_list":["post-23590","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-entity-framework","tag-net","tag-net-core","tag-entity-framework","tag-entity-framework-core"],"acf":[],"blog_post_summary":"<p>New previews of the next versions of EF Core and EF 6 are now available on NuGet.Org. What is new in EF Core 3.0 Preview 6 In recent months, a lot of our efforts have been focused on a new LINQ implementation for EF Core 3.0. Although the work isn&#8217;t complete and a lot of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/23590","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=23590"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/23590\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/21785"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=23590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=23590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=23590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}