Small partners today is the first blog, if there is not correct, or not successful, please give more advice Oh! Thank you, everyone.
It's a shared one! is a relatively simple. NET COde First Data migration, as a workplace small white, I self-taught to find the tutorial is very bitter force, so sent to let more small white less detours.
The main step is three steps.
The first thing to do is open the vs2017 tool > NuGet Package Manager > Package Manager console
Start the first step to enter "enable-migrations"
The first part will generate a migrations Migration folder, which has a configuration named Configuration.cs, to change automaticmigrationsenabled = False to True, using automatic migration;
Then press Ctrl+shif+b to regenerate the project (if you perform this build operation, subsequent steps will fail)
That's how the first step is done.
Next is the second step, "Update-database."
Follow the first step to enter update-database
Okay, so the second step is done so easily.
Then there's the third step.
Make changes in the configuration of the generated Configuration.cs
The last point is to introduce the Global.asax configuration to our context Database.setinitializer (new Migratedatabasetolatestversion<models.model1, Migrations.configuration> ());
ok! Next is done, then you can play happily ...
. NET COde First Data migration technology