Platform .NET 4.5 and Entity Framework 6.
Question I have the following code to execute a Migration:
//The following function just returns an object of the Configuration() class
//generated by code migrations
var migratorConfig = currentMigrationProvider.CreateDbMigrationConfiguration();
var dbMigrator = new System.Data.Entity.Migrations.DbMigrator(migratorConfig);
dbMigrator.Update();
The problem is that Update() function tries to create an instance of my DbContext class and for a few good reasons I need to manually create the context and feed it to dbMigrator. Is that possible? How?
Yes it is possible to control migrations and the context. This is important if you are managing the connection. The example shows connecting to 2 different Dbs. It is a little convoluted. So i built a little test project to demo how.