Upgrade from Entity Framework 6 to EF Core

asp.net-core entity-framework entity-framework-core


I'm trying to move an ASP.NET MVC 5 application to MVC 6 (ASP.NET vNext).

My existing application uses EF 6 and has some EF code first migrations. I want to port these migrations as well, because I want to be able to continue using the existing databases with the existing migrations already applied, without breaking the upgrade path.

It seems that the "new" EF Core migrations (k ef migration add ...) have quite the different format compared to the "old" EF 6 migrations:

  • No more Designer partial class
  • No more RESX file

Is there already an "official" way to upgrade these migrations? Is it supported at all? Will it be supported in the future?

Accepted Answer

There isn't really a way to do this yet. In general we strongly recommend against trying to upgrade an EF6 application to EF7 yet. EF7 is still very much pre-release.

We will have some guidance on how to do this when we get closer to RTM. We may provide some tools to help or just some guidance on how to do it.

Popular Answer

Date: 13/April/2016

As of now it is not advisable to use EF7 in production because of following limitaions

  • "Because of the fundamental changes in EF7 we do not recommend attempting to move an EF6.x application to EF7 at this stage. If you want to move to EF7 to make use of new features, then make sure you are aware of the limitations of EF7 before you start. You should view the move from EF6.x to EF7 as a “port” rather than an “upgrade” ".

  • One area of RC1 that has a number of outstanding issues is our query pipeline. The majority of issues result in an exception when you attempt to execute a LINQ query that contains a particular pattern. There are often ways to workaround these issues by expressing the same query using different patterns, or evaluating parts of the query client-side. We try to include these workarounds in the issue, when they are available.

  • In RC1, there are a number of scenarios where EF7 performs slower than EF6

More Readings:https://blogs.msdn.microsoft.com/dotnet/2015/11/18/entity-framework-7-rc1-available/

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why