Migrating from Entity Framework 6 to EF Core

By | June 17, 2019

We can unanimously agree Entity Framework 6 is stable and battle tested ORM library in .NET eco-system. Since, Entity Framework Core is a complete rewrite of EF6 and is a cross platform solution. Because of fundamental changes in EF Core, there is no straight forward way to move an EF6 code to EF Core except for a diligent rewrite. Not only rewrite but also pay attention to EF Core performance tuning as detailed in our previous articles here and here

EF 6+ on .NET Core

Considering all challenges involved in porting Entity Framework code base into EF Core, there is indeed an active proposal to actually have Entity Framework 6.3 target .NET Standard 2.0+ which will automatically make EF 6 API compliant to run on .NET Core. This approach can make porting existing applications using EF 6+ to EF Core lot easier with minimal changes. Work on the proposal has started. We’re hoping to have it included in .NET Core 3.0 but it is highly unlikely given the fact it isn’t included in .NET Core 3.0 preview.

EF Core is a completely different beast with a different feature set and limitations. Upgrading code investment in EF 6 to .NET Core is no easy endeavor. There are too many breaking changes and may require significant effort and lot of testing cycles depending on code base size before you get it right. we think it is a sound idea to wait for EF 6+ API porting to .NET Core to complete.

Migrate to EF Core 3.0 anyways!!

You love EF Core so much. You’ve compelling reasons and want to take plunge right away and get busy porting Entity Framework 6 code base to EF Core 3.0 for various reasons. For such cases, we suggest you start with Getting started with EF Core to understand migration and also check EF Core 3.0 feature set.

There is an gem of a resource, a latest Channel 9 video shown below highly recommended to understand migration from entity framework 6 to EF Core in full detail.