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?
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.
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.
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!
© 2022 - 2024 — McMap. All rights reserved.