Reputation: 11119
I have a project on .NET 4.8 and EF 6.4.4. We are gradually migrating to .Net Core but during the process can I create a .NET Core data context class, EF Core and point both to same entities?
Upvotes: 3
Views: 691
Reputation: 5531
Yes, you can. Refer to the diagram below.
.netstandard2.0
Dal.csproj
and Dal.Core.csproj
so consumers won't be affected).Dal.csproj
to Dal.Core.csproj
. Now Stage + Commit - this is very important step, otherwise you will loose git history for this class. Now you can do all required changes to make it work with new DbContext
Dal.Core.csproj
back to Dal.csproj
and remove Dal.Core.csproj
project. Do not forget to stage changes before commit so git will recognize moved files as rename rather than delete+add.Tip: make sure you are aware of Cartesian Explosion Problem in EF Core 3
Note: if you are working in Model First approach with EDMX file that's not supported in EF Core, you can't convert the project with EDMX to netstandard2.0
and should keep it as net48
.
Upvotes: 1