Using Code-First Migration With SimpleMembership
In previous posts I have written about customizing and seeding SimpleMembership , the newest membership provider used in ASP.NET MVC 4 Internet applications. In the example in this previous post we setup a database initializer that can be set to either to a type of DropCreateDatabaseAlways or DropCreateDatabaseIfModelChanges . As the name implies DropCreateDatabaseAlways will drop the database and recreate it every time the initializer is called, which is at application start, and will run the method to seed the database after creation. DropCreateDatabaseIfModelChanges varies in that it will only recreate the database if the database model changes in your code. Both of these approaches work great during development and unit testing but you would not want to deploy the solution this way for production. This is where code-first migration comes in. Code-first migration allows you to update the database without having to recreate it and therefore loosing the data that is already i