Frage

Before applying a migration in EF Code First, you can ask to see the SQL script it intends to apply with:

PM> update-database -script

Unfortunately this opens a script named something like tmp939D.sql in Visual Studio and then freezes the IDE until it finishes generating the script. If the script is long, this is a long freeze. Is there some way to push this to a file on the hard drive instead of in the IDE? A way to specify the name of the SQL script file it generates?

War es hilfreich?

Lösung

See this answer for a solution: https://stackoverflow.com/a/14339379/219187

This solution does NOT use -Script, but takes a C# approach. We implemented it in a unit test, so our build server generates the SQL scripts after every software change.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top