I have a db with 5 tables. At the beginning, I've added those tables in, but then decided to remove some due to some relationship compile error.
Now, when i want to add them back, i'm opening the edmx file -> update model from database... I don't see those tables under add tab, but only under the "refresh" tab.
How can i add them back?
right click edmx file > update model from data base > Refresh tab > Tables > select the table(you want to update) and press finish that's it.
Open the edmx file. Right Click anywhere but the tables or relationships. Select "Update Model from Database". Then select 'tables' checkbox in the next dialog box that appears after it has retrieved the data from the underlying database.
In order to re-add a table to your model you will first need to delete the table from your model. (a list of tables is visible in the [model.Store] tree (see 'Model Browser' pane- you can open it from right-mouse click menu). When you run 'Update model from database...' the table will appear in the 'Add' tab in the first step of the 'Update Wizard'.
Steps to complete:
To delete all references to a table in your Model:
I reading this and other searching option, but finally I have found another answered which help me to short-out this issue.
From the error message looks like one of your table/view doesn't have a primary key. EF needs every table to have a primary key in order to generate Entity keys. You may still be able to run your application, but I strongly suggest you add primary keys as warned.
Link which solved my issue.
Updated
If some time you done everything fine, still does not reflect the changes either adding a new column or change data-type.
The best way of this try to update manually, still there is no hope, then as suggested @mathijsuitmegen, delete and add the table, but this is last option to prefer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With