1. Go to the project, either the Web Application or if a separate project for Model, then enable the migration as follows:
PM> Enable-Migrations -ContextTypeName ProductCoC.Model.DataContextThis creates a Migration folder within the project root and creates the initial creation classes as well as the Configuration.cs. Open Configuration.cs and add your seed.
2. Initialize
PM> Add-Migration Initial3. Now, let's update the database:
PM> update-database4. If adding a property to the model classes, change the model class then do an add as follows, any arbitrary name will do:
PM> add-migration AddSoldToPartyAndShipToParty5. Now do a database update:
PM> update-database
No comments:
Post a Comment