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