I just started using EF5. I created a MSSQL database, then I created the model (edmx) file and then used the “Add code generation item” to create EF5 dbcontext classes.
Whenever I alter my database (adding a column or changing a datatype) I see that “update model from database” doesn’t work and I need to delete and recreate the model.
that’s ok for me but what happens to my DbContext classes generated from the model.tt template file? do I have to generate all the DbContext classes again also?
what’s the correct way to work with a database-first environment and keep the .edmx model and the DbContext classes in sync with the database?
After you update your model from database, try to
Run Custom Toolthe Entity Model, works and tested for me.from
Entity Model→ Right Click → Run Custom Tool