I am on a project where we are using Code First on Entity Framework for our database.
We want to change all of our continuous integration to consume a generated MSI package downstream, but with EF that presents a few complications.
- When the model changes, we have to generate a Code Based Migration otherwise the package will break (Database vs. Model)
- We prefer to remove the creation of migrations from the team (based on https://msdn.microsoft.com/en-us/data/dn481501.aspx)
I have tried various things from the web, but most seem to require AutomaticMigrations to be set to true as well as AutomaticMigrationDataLossAllowed (see: http://romiller.com/2012/02/09/running-scripting-migrations-from-code/).
I have tried to replicate what Add-Migration does by looking through .NET reflector but I can't seem to find a way of invoking the command System.Data.Entity.Migrations.AddMigrationCommand that is called through Powershell.
Anyone have any ideas at all on how I can get close to achieving this without doing something extremely messy? It's something I think a lot of people will want to do/have done...
Many thanks in advance!
Add-Migrationcommand?Add-Migrationdoesn't seem to be accessible from outside the VS shell