Question

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

Was it helpful?

Solution

Add-Migration cmdlet 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 is ToolingFacade class from System.Data.Entity.Migrations.Design namespace. 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.AddMigration directly from PowerShell assembly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top