. NET COde First Data migration technology

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.