EF6 in the original database using Codefirst Total review (second, new requirements, simple modification of the original table)

Source: Internet
Author: User

First, enable data migration for the current entity model

The foundation is set up, that is, the original database has, the original database of the entity object also has, but the generated context does not mark whether the current database exists, whether the current entity has been modified (the previous version appears to be marked), so, to first enable the migration.

When you enable migration, new folders and classes are automatically generated, so you can

Files automatically added by the system

The system is reborn as a table in the database.

At this point, the migration preparation is over, and after a period of adaptation, does the other person's child look like their own?

Ii. adding soft-deleted columns for a blog entity object

Third, try to run again

Error due to no isdelete field in database table blogs

Iv. Re-migration

Table Blogs has the Isdelete column

The data in the table still adds the default value, is this the default value we added in the blog constructor? One Test .

After the modification, just repeat the above two steps on the line, where the first name changed to new.

Do not use the client to edit the site's documents, can only create a new article.

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.