指数超出范围。必须为非负数且小于 Nhibernate 中集合错误的大小
我收到异常
索引超出范围。必须为非负数且小于 集合
当我尝试SaveOrUpdate
Bsa 对象时的 。 我认为问题是我将同一行映射两次,一次作为属性,一次作为子列表。
public BsaMap()
{
Schema("MYS");
Table("BSA");
Id(x => x.Id, "BSA_S").GeneratedBy.TriggerIdentity();
HasMany(x => x.BitTypeList).KeyColumn("BSA_S").Fetch.Subselect().Inverse().Not.LazyLoad().Cascade.SaveUpdate();
}
一个Bsa有很多BitType,每个BitType都以BSA_S作为外键。我应该如何映射它,以避免错误?我喜欢将 BSA_S 保留为属性字段。
有什么建议吗?
I receive the exception
Index was out of range. Must be non-negative and less than the size of
the collection
when i try to SaveOrUpdate
a Bsa object.
I think the problem is that i map the same row twice, once as a property and once as a List of children.
public BsaMap()
{
Schema("MYS");
Table("BSA");
Id(x => x.Id, "BSA_S").GeneratedBy.TriggerIdentity();
HasMany(x => x.BitTypeList).KeyColumn("BSA_S").Fetch.Subselect().Inverse().Not.LazyLoad().Cascade.SaveUpdate();
}
One Bsa has many BitTypes, and each BitType got the BSA_S as its foreign key. How should i map this, to avoid the error? I like having the I'd like to keep the BSA_S as a property field.
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题了。在 BitType 实体中,我映射了 BSA_S 两次,
一如:
和:
Found the problem. In The BitType entity, i had mapped BSA_S twice,
one as:
and: