1

I am working on an application that utilizes a database that often has tables added to it or modified. Is there a way I can regenerate the .edmx file as a build step or during compile time to add these new tables/modifications without manually running the wizard?

gillzj00
  • 31
  • 3
  • I'd really like to do this too.I often need to make changes to my tables and views in SQL Management Studio and would love it if my models updated automatically at compile time. – Craig Poole Nov 08 '19 at 11:58

1 Answers1

0

You can try to run sql scripts to insert/modify tables during build process.

Related extension:

Or directly use PowerShell to Execute .SQL Files from Directory.

Reference below articles to change the database during build/release:


UPDATE:

Choosing the Update Model from Database is the best method for updating your EDMX. There are certain properties that don't get updated on the Conceptual layer. See How do you update an edmx file with database changes?

Seems there isn't a good way to achieve that, however if the actions can be executed in command line, then we can add a step to run the command or script.

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • I think you are understanding my problem backwards. The tables are already in the database, I need to update the .edmx file in the solution so I can use reflection to access the generated c# classes from the entity framework date model. Another department maintains the database and I am trying to minimize my involvement in the project. – gillzj00 Feb 23 '18 at 20:26
  • @gillzj00 Seems there isn't a good way to achieve that, however if the actions can be executed in command line, then we can add a step to run the command or script. Check if this thread helps: https://stackoverflow.com/questions/38739950/how-to-update-the-model-when-using-database-first-approach – Andy Li-MSFT Feb 24 '18 at 04:38