DbMigrator - complex code forwarding

When using the package manager console, you can run the following command:

PM> Update-Database -Verbose 

The -Verbose switch writes all attempts of SQL commands to the console window, which is very useful for debugging.

You can use the DbMigrator class to do the same in code:

 Configuration config = new Configuration(); //... (set up the config object) DbMigrator migrator = new DbMigrator(config); migrator.Update(); 

Is there something like the -Verbose switch if you use the DbMigrator class? I looked through all the documentation but found nothing.

+6
c # entity-framework code-first-migrations
source share
1 answer

See if this article resolved your issue:

http://whiteknight.imtqy.com/2013/01/26/efcodeonlymigrations.html

In short:

 MigratorScriptingDecorator scripter = new MigratorScriptingDecorator(migrator); string script = scripter.ScriptUpdate(null, null); 
+7
source share

All Articles