0

In our company we have a lot of legacy applications which use an edmx file together with EF4. We would like to migrate to EF6 (or EF core). Is there a way that we can generate the code first objects (dbcontext, entities) from this edmx with the mappings.

How can we do this?

stephan.peters
  • 963
  • 13
  • 35

2 Answers2

0

Maybe the best solution for this will be scaffold (reverse engineer your model) from current database.

EF Core has nice powershell tools for this scaffolding https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db You can also split the whole (maybe big) DbContext to more DbContexts with specified Table parameter https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell

EF 6 has also some options for scaffold actual database Entity Framework - Generating Classes

Jaroslav Surala
  • 93
  • 1
  • 1
  • 8
  • The problem is that the edmx is strongly mapped. We don't want to restart from the oracle database. We want minimal code breaks. The names in the database are different for example. – stephan.peters Jan 10 '18 at 17:02
  • Maybe this answer can help you https://stackoverflow.com/a/14882632/2866538 coverting yout edmx to EF 5.x code first and afther that migrate to EF 6 – Jaroslav Surala Jan 10 '18 at 17:35
0

Why would you bother generating anything from .edmx? What if you created new project with code first from existing database?

helpME1986
  • 933
  • 3
  • 12
  • 26