Code First method build from scratch
- Make a backup of /Model files and /Migrations and delete xxx_Initial.cs one, delete all files under /Migrations, delete all tables in database
Alternatively run: Update-Database -TargetMigration $InitialDatabase to roll back to what it was
- Run enable-migations -Force in PM>
- Change the /Migrations/configuration.cs file with file below – notepad
- Run add-migration Initial in PM>
- Run update-database in PM>
- Check the database and all the class table in there as well Identity one (ASPNETxxx) and also the /Migration/xxxxxxxx_Initial.cs appearing with ASPNET as well.
- The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running ‘Add-Migration Initial’ again.
- Adding a Created Date/Time Column Automatically with Code First Migrations – https://andy.mehalick.com/2014/02/06/ef6-adding-a-created-datetime-column-automatically-with-code-first-migrations/
- Introduction to MVC – https://mva.microsoft.com/en-US/training-courses/introduction-to-asp-net-mvc-8322?l=nKZwZ8Zy_3504984382
- Code-First Migration and Extending Identity Accounts in ASP.NET MVC 5 and Visual Studio 2013 – http://www.codeproject.com/Articles/674760/Code-First-Migration-and-Extending-Identity-Accoun
- Use Code Migrations to Seed the Database – http://www.asp.net/web-api/overview/data/using-web-api-with-entity-framework/part-3
- Code First Migrations and Deployment with the Entity Framework in an ASP.NET MVC Application – http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
- Creating a More Complex Data Model for an ASP.NET MVC Application – http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-a-more-complex-data-model-for-an-asp-net-mvc-application
- Survey database design – http://stackoverflow.com/questions/540885/what-mysql-database-tables-and-relationships-would-support-a-qa-survey-with-con