So I have a database and have created a model from it. Everything works just fine. But now I want to add more tables to my database and produce models from them.
Is that possible with EF Database first? Do I have to recreate all models for it to add new ones? All tables are of course from same database.
Example:
Let's say I have Table1
, Table2
, and Table3
.
And by using DBContextGenerator
in VS I've generated models from .edmx
file. So I'd have Model1
, Model2
, and Model3
for corresponding database tables, and I'd like to add Table4
and Model4
.
Do I have to recreate everything or is it possible to add somehow?
Open up your .edmx in design view. Right click in there somewhere and choose "Update Model from Database". On the "Add" tab, expand "Tables", and find your new database tables. Check them, and click finish.
I've done this regularly as the DB changes and tables are added during development, it's been very reliable.