I am creating a small program over entityframework which allows to edit the POCOs with a UI. as part of the process i would like to call the “add-migration” command from my code to save the interaction of the rest of the programmers with the program manager console. is it possible at all?
thanks
Add-Migrationcmdlet is defined in separate EF 4.3 Powershell assembly used by Package manager console. This assembly references a real EF 4.3 assembly. The core logic exposed from that assembly isToolingFacadeclass fromSystem.Data.Entity.Migrations.Designnamespace. The exposed logic involves retrieving database and pending migrations and scaffolding a new migration but PowerShell assembly contains the execution workflow and creates bridge between EF, PowerShell and Visual studio (adding classes to your project) – this is what you must reverse engineer and reimplement in your tools.Edit: You can also try to run
MigrationCommands.AddMigrationdirectly from PowerShell assembly.