Entity-framework – Entity Framework : How to refresh the model when the db changes

entity-framework

If you build the edmx file from the database and then the db changes, how do you get the model to pick up the change?

Do you delete the whole model and regenerate or can you detect changes?

I see a post mentioning a "Update Your Model" rt. mouse command on the edmx file, but I dont see it.

Updating your edmx to reflect changes made in your db (.net linq-to-entities)

I'm just starting out.

Best Answer

Are you looking at the designer or code view? You can force the designer to open by right clicking on your EDMX file and selecting Open With -> ADO.NET Entity Data Model Designer

Right click on the designer surface of the EDMX designer and click Update Model From Database...

All entities are refreshed by default, new entities are only added if you select them.


EDIT: If it is not refreshing well.

  • Select all the tables and view-s in the EDMX designer.
  • Delete them.
  • Then, update model from database