How to migrate the EF6 structure and the ef6 structure in the case of multiple models

Source: Internet
Author: User

How to migrate the EF6 structure and the ef6 structure in the case of multiple models

The so-called multi-model is to include two different models in a database, or in other words, the data of two different DbContext is put in the same database. The multi-model here is not a multi-tenant database (anyone who knows that EF is a good solution for handling multi-tenant databases can contact me to share with you), and does not support cross-model data sharing.

Julie Lerman published an article titled EF6 Code First Migrations for Multiple Models on MSDN Magazine to illustrate two feasible solutions to this problem:

1. Use a new feature of EF6 to define different contextkeys in DbMigrationsConfiguration.

2. Use the database architecture (Schemas) to separate models and migrate, that is, add a sentence modelBuilder. HasDefaultSchema ("ModelTwo") in OnModelCreating ");

In the case of multiple models, some tips may be required for enabling migration and adding migration. This article also provides detailed solutions.

The use of multi-model in EF brings two benefits: it is more in line with the domain-driven design (DDD) and has a lower cost in cloud services such as Azure.

Address: https://msdn.microsoft.com/en-us/magazine/dn948104.aspx

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.