Updating controllers and forest types with model changes

For the basic functionality of my project, I defined Entity Framework models and then used the scaffolding function for Visual Studio to implement CRUD functionality ( Right Click β†’ Add β†’ New Scaffolded Item... ).

If I need to make changes to the model after I do this, how do I make updated controllers and views update to the latest model changes? For example, now I see the need to add a new attribute to my model and change the data type of the existing one, but the controllers and views probably will not work after the change.

I could always just redraw, but I made some changes to the controller and views that I don't want to lose. My only decision to make changes myself?

+6
source share
1 answer

Rename the files with your changes, scaffold again and replace the newly created forests with your originals.

Naturally, you will have to reconcile any domain changes made to files containing your changes.

+3
source

Source: https://habr.com/ru/post/981157/


All Articles