Explicit many to many join table in Entity Framewo

2019-04-08 23:08发布

问题:

By default EF hides a many to many join table that does not contain additional data than the foreign keys to the joined tables.

Is it possible to tell EF (and the designer) to explicitly create the join table and make it usable in code?

Thanks

回答1:

No EF designer will not add this entity for you. If you want junction table exposed you must manually delete created relation and add junction table's entity and two one-to-many FK relations. Here are related questions with step by step guide:

  • How to expose the join table in many to many relation
  • How to get Entity to Table mapping for many to many relations