Add new table to EF

我们两清 提交于 2019-12-08 13:03:29

Murali, if I understood well, the problem is that you didn't make changes to the database since you've created the model. If this statement is correct, take a look at this:

Add tables starting from the model is a Model-first approach. Starting from code is a Code-first approach. However, you are trying to update the model from a existing database. That is a Database-first approach. For a database-first approach, the steps you mentioned are right.

However, in this approach you shouldn't be trying to develop new tabes starting from the model. Instead, you should open your sql server management studio (or database project) and code the new schema there. Then, after coding the updates in the schema, you go back to your model and follow the steps that you described.

Hope it helps.

make sure that your table have at least one primary key in order to get added to the entity model. It works accurately when your table (which is to be added) have one primary key.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!