Search code examples
c#entity-framework-migrationsef-core-6.0entity-framework-core-3.1

"Update" migration scripts for Entity Framework Core 3.1.8 to 6.0.4


We are in the process of migrating our .NET Core 3.1 application to .NET 6. While doing so, we also need to update the Entity Framework Core NuGet packages.

Doing so also means, we need to "update" our migration scripts. Unfortunately I wasn't able to find any documentation about how to do that. I did found the list of breaking changes and other useful documentation, but missing any explicit information about migration scripts.

What I tried so far was executing the command Add-Migration from Package Manager Console which did create empty migration scripts, but also "updated" the DbContextModelSnapshot file. This looks okish so far. I was playing around with our application a bit and did not noticed any exceptions yet. So far so good.

But is this the "correct" way to go when moving from .NET Core 3.1 to .NET 6?


Solution

  • You've pretty much did it. When I switch to a different version of EF Core I just install newest nuget packages and make it update the snapshot, just the way you did. Just check out the list of breaking changes for newer versions of EF and make sure you're not affected:

    https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/what-is-new/ef-core-6.0/breaking-changes.md