maandag 30 juni 2014

Entity framework 6; -Script for Migrate.exe (Update)


After Enity Framework 5, 6 came along and so the old EntityFramework.Commandline V5 needed an update. The code which is provided as-is and without any warranty can found here is;
  • compiled against Entity Framework 6.0.0.0 (Adding the new "contextAssemblyName")
  • targeting .net 4.5
  • freed of a few bugs;
    • Putting .dll after the "assemblyName" is handled transparently
    • MultiShotMigration is a boolean
    • SQL script printing order is corrected
As a general quick try;
  • Copy the dll's found in \packages\EntityFramework.6.0.X\lib\net45 to the build output folder of your database project (for example \Database\bin\Debug)
  • Copy the EntityFramework.Commandline files (\EntityFramework.Commandline\bin\Debug) to the build output folder of your database project (for example \Database\bin\Debug)
  • Open a command window on the same location (build output folder of your database project)
  • Execute the command below;
EntityFramework.Commandline -ConnectionString="Server=.;Database=DbName;Integrated Security=True;" -ConnectionProviderName="System.Data.SqlClient" -AssemblyName="YourDatabaseAssemblyName" -Verbose -Unattended

Geen opmerkingen: