Friday, 15 March 2013

c# - DbMigrator - verbose code-first migration -



c# - DbMigrator - verbose code-first migration -

when using bundle manager console, can run next command:

pm> update-database -verbose

the -verbose switch write attempted sql commands console window, quite useful debugging.

you can utilize dbmigrator class same in code:

configuration config = new configuration(); //... (set config object) dbmigrator migrator = new dbmigrator(config); migrator.update();

is there -verbose switch if utilize dbmigrator class? looked on documentation, couldn't find anything.

see if article solves problem:

http://whiteknight.github.io/2013/01/26/efcodeonlymigrations.html

in short:

migratorscriptingdecorator scripter = new migratorscriptingdecorator(migrator); string script = scripter.scriptupdate(null, null);

c# .net entity-framework code-first-migrations

No comments:

Post a Comment