hey all
i'm not sure how to map this.
i have got buyer,
buyer can have many buyers.
then i got contract,now, for each contract the buyer have many different buyers..
public class Buyer
{
private IList<Buyer> m_buyerList = new List<Buyer>();
pub开发者_Go百科lic virtual IList<Buyer> BuyersList
{
get { 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 you guys.
Buyer mapping:
HasManyToMany(x => x.BuyersList)
.ParentKeyColumn("ParentBuyerId")
.ChildKeyColumn("BuyerId")
Contract mapping:
References(x => x.MainBuyer);
精彩评论