How do I propagate database changes to my .edmx fi

2020-02-12 05:38发布

问题:

I generated an .edmx file from database.

I want to know if I make changes to my database schema then how will those changes be reflected in my Entity Data Model Designer diagram? I made changes to my database schema but found the changes did not appear in my Entity Data Model Designer diagram. Can someone explain to me how to propagate database schema changes to my Entity Data Model Designer diagram?

回答1:

I think what you are asking is if you change your schema, how is this then updated in your EDMX file?

  1. Open your EDMX file in Visual Studio
  2. Right click on the design surface
  3. Select 'Update Model from Database'
  4. Follow the wizard to 'Refresh' your model.

Your changes should now be visible on the design surface in the respective containers.



回答2:

so i want to know if i add or remove any field from table then how change will be reflected in my Entity Data Model Designer where diagram show.

Additions in your tables will be reflected in your model if you "Update Model From Database" as posted in the other answers. If you delete tables or columns though in my experience you have to remove the corresponding entity manually from your model and then update the model from the database.



回答3:

Right click in the edmx, click "Update Model From Database". Go over to the "Refresh" tab, and click "Finish".



回答4:

You need to open up your model and right click on an empty space and select Update Model from Database...



回答5:

When using 'Update from Database' you can also select whether to add new tables from your database if required, or leave them out.