NHibernate 多对多参考帮助
我有如下 2 个表(实体)
NewsLetter
-------------------
Id
UserEmail
AgreeToReceiveNewsLetters
DateRegisted
Voucher
-------------------
Id
Code
IsActive
PromoText
CreatedDate
MaxDaysToRedeem
和用于多对多关系的第三个参考表
NewsLetterVoucher
-------------------
Id
NewsLetter_id
Voucher_id
ValidFrom
ValidUntil
DateRedeemed
DateNotified
一切都工作良好 多对多关系的映射工作良好 问题是我想在实体模型中访问存储在引用表( ValidFrom 、 ValidUntil 等)中的附加信息,
就像
NewsLetter.Voucher[0].ValidFrom
但 ValidFrom 存储在参考表中
我该怎么做
I have 2 tables (entities) like the following
NewsLetter
-------------------
Id
UserEmail
AgreeToReceiveNewsLetters
DateRegisted
Voucher
-------------------
Id
Code
IsActive
PromoText
CreatedDate
MaxDaysToRedeem
and a third reference table for many to many relationhip
NewsLetterVoucher
-------------------
Id
NewsLetter_id
Voucher_id
ValidFrom
ValidUntil
DateRedeemed
DateNotified
All is working good the the mappings for the many to many relationship working good
The problem is that I want to have access in the entity model at the additional information that are stored in the reference table (ValidFrom , ValidUntil etc)
just like
NewsLetter.Voucher[0].ValidFrom
but ValidFrom is stored in the refenece table
How I can do that
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个类似的问题( NHibernate:与关系表中的字段的多对多关系)。您需要将关系表映射为类。
There is a similar question (NHibernate: Many-to-many relationship with field in the relationship table). You need to map the relation table as a class.
如果我理解正确的话,我认为这可以解决您的问题。
Fluent nhibernate - 带属性的多对多映射
I think this is a solution to your problem, if I understand it correctly.
fluent nhibernate - Many to Many mapping with attribute