Update Model From Database doesn't add new table from database
Asked Answered
E

3

7

I have an ADO.NET Entity Data Model created. Everything worked fine, until I added new table in my database. So I wanted to add that table to my data model. I followed these steps: Right click on my model -> Update From Database. Than the wizard opens where I chose what I want to add. When I expand tables tree, my table which I have added to my database is there. I check it and click finish. No errors, everything is successfully done, but there is no any changes on my model. The table is not added to my model. Does anyone know why is this happening?

Extraterritoriality answered 18/3, 2014 at 10:45 Comment(0)
R
17

When EF complains about certain things (i.e. missing pk) after adding tables to your model trough the "update database" wizard, it does not produce an error or a warning but a message in the error list window. make sure have have checked that. in my case EF was complaining about tables with no primary key defined.

Rerun answered 18/3, 2014 at 11:8 Comment(2)
did that help you to spot your problem?Rerun
this acctualy was a solution to my problem but I found out that before you answered so I didn't see your post. Thank you!Extraterritoriality
H
1

Try saving the updated model and then reopening it. I added two tables and although the designer view had a * on it (indicating it was changed), I couldn't see my new tables. On a hunch I closed and reopened the model and the tables were there. This is in VS 2017.

Hohenlinden answered 8/3, 2018 at 20:38 Comment(0)
W
0

I'm sure no one else will be this stupid, but ... make sure that your web.config file is pointing to the correct database (development or production).

Mine wasn't!

Windcheater answered 9/10, 2023 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.