Entity Framework : Sharing entities across different DbContexts

后端 未结 4 1550
后悔当初
后悔当初 2020-12-30 07:12

I\'m developing a plugin application with EF6, code first.

I have one main context with an entity called User:

public class MainDataCont         


        
4条回答
  •  悲哀的现实
    2020-12-30 07:46

    This solution could help you:Entity Framework 6 Code First Migrations with Multiple Data Contexts. However, in this case, both context are in the same project. I don't know if works with contexts that are in two different projects (I think it should if you are using the same class to map User). As the blog said, you need to comment the generated code related to the Users table when you run the Add-Migration command for the PluginX Context.

提交回复
热议问题