Updating Entity Framework EDMX when changes are made to the database.

This isn’t obvious, at least it wasn’t to me and for some reason when I searched for this I didn’t come up with the answer either.

To update the Entity Framework EDMX and sync it with your DB changes you double click on the EDMX in the VS2010 Solution Explorer. This brings up the designer (Model Browser window apparently is what it’s called) with a class layout of your entities. Right click anywhere on the designer surface and you’ll see an option in the dialog to “Update Model from Database.” Click on this and you get brought into the Update Wizard where you can choose the database objects you want to Add (if new), but by default it refreshes existing objects.

One thing the wizard doesn’t seem to do is delete columns from existing objects. Probably some sort of safety mechanism, but if you deleted the column from the database, do you really want to keep it in your entity? Ah well, who knows.

EDIT: Of course right after I write this post I find this page, which still isn’t particularly clear about how you get to the “Model Browser window,” but maybe I’m just dumb.

4 Comments

  1. I found that when you update the model, it does not make the changes in the entity object. I added a new column in a table and updated the model. It did update the model properly. However, no changes were made in the entity. It appears there may be a setting for this.

Leave a Reply

Your email address will not be published. Required fields are marked *