在实体框架4外显多对多的连接表 [英] Explicit many to many join table in Entity Framework 4

查看:126
本文介绍了在实体框架4外显多对多的连接表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在默认情况下EF隐藏着一个多对多的连接表不包含额外的数据比外键连接表。

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

是否有可能告诉EF(和设计师)明确创建的连接表,并使其在code可用?

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

感谢

推荐答案

没有EF设计不会为你添加这个实体。如果你想结合表暴露你必须手动删除已创建的关系,并添加结表的实体和两个一对多FK关系。下面是一步引导相关步骤的问题:

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:

  • <一个href="http://stackoverflow.com/questions/5304087/ef4-how-to-expose-the-join-table-in-a-many-to-many-relationship">How揭露连接表中多对多的关系
  • <一个href="http://stackoverflow.com/questions/5910517/how-to-get-the-entity-to-table-mapping-for-many-to-many-relations-from-the-metamo">How让实体表映射多对多关系
  • How to expose the join table in many to many relation
  • How to get Entity to Table mapping for many to many relations

这篇关于在实体框架4外显多对多的连接表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆