Fluent Nhibernate - 来自两个类的连接/引用表
我有三个类:
Class A
{
string name
IList<AB> list
}
Class B
{
name
}
Class AB
{
A a
B b
}
B 类与 A 分开存在。它以自己的方式存在,并且是其他类中类似列表的一部分这就是我有参考表的原因。
问题是,自动映射器生成模式给了我这个模式:
A{id, name}
B{id, name}
AB{id, AFK}
关于 AB 模式,我期望 BFK 也在那里,并且我不期望 id 字段,因为它不需要。应该是AFK和BFK之间的复合PK。
我正在使用自动映射器,目前没有覆盖。
请注意,我不想将 IList 包含到我的 B 类中,因为它在那里没有位置。
请帮助 - 我一直在寻找解决方案,我觉得这应该是一个简单的解决方案。当我从 ER 直接建模到 sql 表时,如果实体都很强大,我就会被告知这样做。
I have three classes:
Class A
{
string name
IList<AB> list
}
Class B
{
name
}
Class AB
{
A a
B b
}
Class B exists separate from A. It exists in its own right, and of is part of similar lists in other classes This is why I have the reference table.
Problem is, automapper generate schema gives me this schema:
A{id, name}
B{id, name}
AB{id, AFK}
WIth regards to the AB schema, I'm expecting BFK in there as well, and I'm not expecting the id field, as it's not needed. It should be a composite PK between AFK and BFK.
I'm using automapper, with no overrides at the mo.
Please note, I do not want to include IList into my Class B, as it has no place there.
Please help - I have been looking all over for the solution to this, and I feel it should be a simple solution. Back when I modelled from ER direct to sql tables this was how I was told to do it if the entities were both strong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是你必须覆盖
unfortunately you have to override