0

When attempting to update my Entity Framework model from the database using Database First, any Navigation Properties that were already present on the Entity models are added again with a numbered suffix (e.g. Order would have Order.Items and Order.Items2).

How can I update the model from the database without having to clear the edmx and create a "fresh" model every time?

Nathan Montez
  • 461
  • 3
  • 8
  • When you update a EF model, you have the wizard where you can choose options to add, update, etc... Is the wizard offering you to add the same tables already created? – Xurxo Garcia Nov 18 '16 at 15:09
  • @XurxoGarcia If I do nothing but let it Refresh the models that are currently tracked, the duplicates are added. I usually get around this by selecting all on the designer, remove them from the model, and add them again through the wizard. – Nathan Montez Nov 18 '16 at 15:20
  • @usmanlqbal This is not a code problem, but rather a problem working through the edmx designer. – Nathan Montez Nov 18 '16 at 15:21
  • I think could be a problem using Database First when you modify something in the tables according this [question](http://stackoverflow.com/questions/26757860/entity-framework-database-first-multiple-relations-to-same-table-naming-conven) Read the comments to the first answer for details – Xurxo Garcia Nov 18 '16 at 15:52

0 Answers0