Using the Entity Framework 5.0, I am attempting to manually migrate my code-first database during my MVC site's start up routine. To do this, I first create a DbContext instance and then run the following code:
var migrator = new MigrateDatabaseToLatestVersion<DataContext, Configuration>();
migrator.InitializeDatabase(this.dataContext);
I assumed the database associated with the dataContext's connection would be the one migrated. It appears though that this is not the case. Instead, it always tries to migrate a database on a local SQLExpress instance.
There is an overload to the MigrateDatabaseToLatestVersion constructor that takes a DB connection string name, but my project is using Azure and doesn't use the standard ConnectionStrings configuration section. Ideally, I'd just pass it a connection string, which I have available. Is this possible?