C# – Enable Migrations in Visual Studio using Entity Framework

This article is rather small, but its target is to remind me how to enable migrations of database in Visual Studio.

bird

Thus, the steps are:

  1. Press Ctrl + Q to go to the quick launch.
  2. In the quick launch write “Package Manager Console” and press enter.
  3. Make sure that you have selected the correct Default project in the console.
  4. In the console write> Enable-Migrations -EnableAutomaticMigrations and press enter.
  5. In the solution explorer, you get a folder migrations, in which a file Configuration.cs is present.
  6. If you open it, you may configure it this way (just an example, do not ever do AutomaticMigrationDataLossAllowed = true in production):

And that is it!

 

About

VBA Developer

Tagged with: ,