Entity Framework migrator's connection
问题 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