EF 4.3 Auto-Migrations with multiple DbContexts in one database

前端 未结 9 1730
梦谈多话
梦谈多话 2020-12-01 01:20

I\'m trying to use EF 4.3 migrations with multiple code-first DbContexts. My application is separated into several plugins, which possibly have their own DbContext regarding

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 02:27

    I just came across this problem and realised the reason I had split them into different contexts was purely to have grouping of related models in manageable chunks and not for any other technical reason. Instead I have declared my context as a partial class and now different code files with different models in them can add DbSets to the DbContext.

    This way the automigration magic still works.

提交回复
热议问题