在实体框架中禁用外键暴露?
当我最初创建动态数据项目时,我告诉它公开外键,但现在我无法在外键的两个实体之间进行映射。当我在专注于关联时单击映射详细信息时,我收到以下消息:
映射不允许通过公开的外键进行关联。
因此,我想禁用外键的暴露,但不确定如何在不从头开始创建新实体模型的情况下执行此操作。我还没有走得太远 - 所以这并不难,但我想必须有一个程序化的切换?
When I originally created a Dynamic Data project I told it to expose the foreign keys, but now I can't make mappings between two entities b/c of the foreign keys. When I click on mapping details while focused on my association I receive the message:
Mappings are not allow for an association over exposed foreign keys.
So I'd like to disable the exposure of the foreign keys but am unsure how to do this without creating a new Entity Model from scratch. I'm not far along - so that wouldn't be hard, but I imagine there must be a programmatic switch for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需从实体中删除外键属性即可。
然后删除关联-->在实体之间添加新关联并取消选中:
“将外键属性添加到..X”
Just delete the foreign key property from the entity .
then delete the association --> add new association between the entities and uncheck the :
"add foreign key properties to..X"