Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade from Entity Framework 6 to EF 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?

like image 317
Hannes Sachsenhofer Avatar asked Nov 23 '14 12:11

Hannes Sachsenhofer


People also ask

Can I use Entity Framework 6 not core in .NET core?

To use Entity Framework 6, your project has to compile against . NET Framework, as Entity Framework 6 doesn't support . NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core.

How can I change Entity Framework 6 to 5?

In this situation you can upgrade to EF5 using the following steps: Select Tools -> Library Package Manager -> Package Manager Console. Run Install-Package EntityFramework -version 5.0. 0.

Does ef core 6 require .NET 6?

NET Framework versions will need to target . NET 6 to use EF Core 6.0.


1 Answers

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.

like image 104
Rowan Miller Avatar answered Sep 25 '22 01:09

Rowan Miller