开发者

NHibernate Many To Many reference help

开发者 https://www.devze.com 2023-02-22 09:40 出处:网络
I have 2 tables (entities) like the following N开发者_开发知识库ewsLetter ------------------- Id

I have 2 tables (entities) like the following

N开发者_开发知识库ewsLetter
-------------------
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


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.


I think this is a solution to your problem, if I understand it correctly.

fluent nhibernate - Many to Many mapping with attribute

0

精彩评论

暂无评论...
验证码 换一张
取 消