I would try using Entity Framework's Code First Migrations (http://msdn.microsoft.com/en-us/data/jj591621.aspx).
Short version:
1) In your DbContext, set the initializer to CreateDatabaseIfNotExists similar to Database.SetInitializer<YourDbContext>(new CreateDatabaseIfNotExists<YourDbContext>());
This will allow EF to create the DB if no database exists (the first time the application is run).
2) Next, go to the Package Manager Console, select your Database project (if separate), and enter the command Enable-Migrations. This will create some migration scaffolding and an initial migration.
Whenever you change your database model in code from then on, do the following steps:
3) After you've changed your code-first model, go to the Package Manager Console, select the Database project, and type the command Add-Migration MigrationNameHere This will scaffold out a new separate migration that can be applied to your database. Note, this command will run for whatever db is in your current connection string config.
4) To apply the migration, and update your database to the new schema, type the command Update-Database. If everything goes well, your database will be updated (with data) to the new schema! You should now be able to run your MVC project without db errors.
Keep in mind, this is the very basic version of db-migrations, please try it out on a dummy project first, and of course backup your data. If the changes are complex, or you need to do a special migration of data, you can edit the scaffolded migration code in the Migrations folder created, before doing the Update-Database.
Hope this helps!
Seed())Seed()anywhere, I'm just creating a test object and inserting it, then callingdbContext.SaveChanges(). If the object has a field that is not in the DB schema, it throws and exception instead of dropping the table/db and auto-creating the schema to match the model classes.