Add Table in Existing Code First Database Approach

code-first entity-framework-6

Question

I have created 10 Tables in SQL server now using code first approach I have added 5 tables in my project. Based on this 5 tables it created 5 class in my project and then I completed my code of insert, update, delete and it work perfectly.

Now I want to add other 5 tables what should I do for this?

1
2
5/8/2015 3:46:47 AM

Accepted Answer

Sounds like you are doing Code First to an Existing Database where you create the tables in SQL Server and then reverse engineer the classes. You can reverse engineer the remaining classes by repeating the process and selecting just the tables you need from the wizard(https://msdn.microsoft.com/en-us/data/jj200620.aspx). This will create the POCOs and a model class with the DBSets and config info. I usually move my classes to a separate project and cut and paste the new DBSets and config info.

2
5/6/2015 5:24:15 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