简体   繁体   中英

ASP.NET MVC - Easy way to update the strongly typed view, when model adds additional fields?

Existing Model, Controller and View, all working well.

Due to a requirement change, there is suddenly a change in the db schema, need to add a few new fields.

Database is updated, model (ADO.NET Entity) is refreshed from database and new fields are picked up. Controller is OK since it is working with the "set" and keying off the PK. The view when originally created was strongly typed against the model (as it was at the time)....

Is there an easy way to "refresh" the existing view to pick up the new fields?

Or will this always be a manual addition or where you would need to create a "newer" view to replace the previous view?

Thanks!

On the slim chance you're using the exact view created by the "add view" command, you can just delete/re add it. Otherwise, you can add a new temporary view, copy over the new/changed fields and then delete your temporary view.

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