Updating An ADO.NET Entity Data Model After Changing Database

While using ADO.NET and the Entity Data Model in .NET many times there are changes to your database while in development. As we know it is hard to exactly get the data model exactly right on the first try so we tend to revise as we go along. The Entity Data Model (similar to other CRUD scaffolding systems) in .NET will look at the current database structure and determine rules for data entry and editing. What commonly occurs is the database structure changes but the EDA (Entity Data Model) is not updated within .NET. Here is the quick solution to update these changes:

  1. Open the Model Browser buying double clicking on your .edmx file.
  2. Right-click in opened .edmx window (you should see the tables in your database) and select “Update Model from Database”
  3. A dialogue window will appear with three tabs Add, Refresh, and Delete. Choose Refresh.
  4. From the tree of tables select the database table(s) you wish to refresh and click “Finish”

Now you’re changes that were made to the database are now reflected in the EDA.

Leave a Reply

Your email address will not be published.