简体   繁体   中英

EF CodeFirst- Merging two DbContext

I have two DbContext , one for Asp.net Identity and other one is for the rest of my domain. Now according to this design I have many problems to manage Initializing database. As you may know I would like to seed those tables belong to each DbContext which has its own issues. I want to know is this good idea to merge those DbContext instead of having one for each one?

Any advice will be helpful.

I would do just a single DBContext for both Identity entities and other. This way you can easily build relationships between you user/roles entities and the rest of your domain.

Are you using Identity 2.0? Take a look at this question: ASP.NET Identity DbContext confusion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM