The model that supports the XXXDBCONTEXT context has changed since the database was created. Consider the workaround for using the Code first migration Update database

Source: Internet
Author: User

Scenario: When I add a validationattribute checksum for a field in an entity model class in models, a model that "supports" xxxdbcontext "context appears on the page after the run has changed since the database was created. Consider using the Code first migration update database "error;

Workaround:

1. In the VS Click Tools->nuget Package Manager, Packages Manager console:

Enter Enable-migrations-force (the last side here has a space)

2. Then follow the prompts to enter:

3, after running in the Code editing window will appear Migrations folder class configuration is open, the automaticmigrationsenabled value is changed to TRUE.

4. The Package Manager console now prompts "No automatic migration is applied because automatic migration results in data loss":

Just run the add-migration Initial command in the console window and enter Update-database to perform the update.

The model that supports the XXXDBCONTEXT context has changed since the database was created. Consider the workaround for using the Code first migration Update database

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.