James Ray Anderson

James Ray Anderson
James Ray Anderson
0 comments

Add New Fields to your MVC Project in under 10 minutes (Part II)

11:19 AM
Overview
So you have been working with an MVC project for a while and you now have to add a few columns to the database and get your model and views updated.

What You Will Do
- Update database schema
- Update model
- Update controller
- Update views


Update Database
  1. Double-click on your MDF under App_Data and open the Server Explorer.
  2. Expand the table you want to add the column to.
  3. Right-click and select Open Table Definition.
  4. Add the column and click Update > Update Database.
  5. Add the related field(s) to the Create, Edit, View, and Delete pages.
  6. Rebuild and run.
At this point when you run you will stop at a breakpoint with an InvalidOperationException.InvalidOperationException


0 comments:

 
Toggle Footer
Top