c# - complicated relation fluent nhibernate -
hey all
i'm not sure how map this.
i have got buyer,
buyer can have many buyers.
got contract,
now, each contract buyer have many different buyers..
public class buyer { private ilist<buyer> m_buyerlist = new list<buyer>(); public virtual ilist<buyer> buyerslist { { return m_buyerlist; } set { m_buyerlist = value; } } public virtual string name { get; set; } public virtual int id { get; set; } public virtual string address { get; set; } public virtual string extraaddress { get; set; } public virtual string phonea { get; set; } public virtual string phoneb { get; set; } public virtual string phonec { get; set; } public virtual string email { get; set; } public virtual string fax { get; set; } } public class contract { public virtual buyer mainbuyer { get; set; } public virtual datetime signeddate { get; set; } }
thank guys.
buyer mapping:
hasmanytomany(x => x.buyerslist) .parentkeycolumn("parentbuyerid") .childkeycolumn("buyerid")
contract mapping:
references(x => x.mainbuyer);
Comments
Post a Comment