add table to DbContext from existing database?

.net asp.net c# entity-framework-6 visual-studio

Question

Using the wizard, I created a DbContext from an existing database and only selected one table to be pulled in. However now I need to add additional tables from that database to the Entity Model.

What is the easiest way to add more tables from an existing database to a context that I have already created and to also generate the respective models for those tables?

1
1
12/5/2016 7:25:54 PM

Popular Answer

Easiest way is:

1) Open your .edmx database

2) Right click and choose "Update model from database..."

3) check the tables you want and click finish

4) EF will create all your entity classes for you

4
12/5/2016 7:30:04 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow