I am attempting to deploy my first alpha version of a system online for a few people to start using. On development I make heavy use of the DropCreateDatabaseOnModelC
If you are using sql express in development and not on your production box you can filter by the connection.
protected void Application_Start(object sender, EventArgs e)
{
using (var db = new MyDb())
{
if (db.Database.Connection.DataSource.IndexOf("sqlexpress", StringComparison.InvariantCultureIgnoreCase) > -1)
{
Database.SetInitializer(new MyDbInitializer());
}
}
}