简体   繁体   中英

Entity Framework to update the Model to reflect the changes in database

I am working on web Application which is developed by other programmer.
I have added a new table in database. So, now I wanted to add a correspondingly Model class. For this purpose the developer have already added a temple to auto-generate the model classes. I am new to .NET and Entity Framework. From the information I got from internet that I can update the Model by using "Run Custom Tool". But when I execute it, It doesn't add new model class for the new table.
If anybody can give me any pointers, about the required steps to perform this operation.
Any help is very much appreciated.

Well, It depends which EF technique you are using. 1. Code First If you are using code first, add the new model classes into the model section. Then from Package Console, generate the changes set and update the DB

  1. Model First Simply create a Model inside the model explorer, create the fields corresponding to DB tables and define the mappings.

  2. Database First Simply drag-drop the table from Server-Explorer and save it.

These might be of some help

http://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM