How to support Multiple Entity Framework Models in the same solution

后端 未结 2 1512
挽巷
挽巷 2020-12-30 09:00

I have begun developing an application using the Entity Framework.

I have added a namespace to contain all of my user management code MyApp.Users for example, and th

相关标签:
2条回答
  • 2020-12-30 09:18

    You can definitely have multiple models - but they cannot overlap. The error message is pretty clear - if they do overlap, how would EF know which CLR type to map to - there's no way of telling that, really.

    In your case, you could possibly try to extract the Users table into a third model of its own, if it needs to be used in two other places as well.

    Marc

    0 讨论(0)
  • 2020-12-30 09:25

    In order to reuse types in multiple models, you need to follow some specific steps outlined in this blog post. Like many more advanced Entity Framework features, this works, but doesn't work so well with the GUI designer. See also this intro post for more ideas on dealing with larger models.

    0 讨论(0)
提交回复
热议问题