EF Code First: Adding columns to table

1. Make the change to the class, e.g., below I added SortOrder property

2. Open Package Manager Console and type:
     PM> add-migration AddSortOrderFieldToTriples – Context TripleDbContext


This will result in the auto-generation of the AddSortOrderFieldToTriples class.   Note below that since my TripleDbContext resides in a separate assembly (not the web application) I have to set the “Default Project” to its location.   Since there are two context (ApplicationDbContext and TripleDbContext) in that assembly I have to also provide the –Context parameter.


Once the classes have been updated you will type in the following:

PM> update-database –verbose –Context TripleDbContext

This will apply the change to the database table as shown below: