2013-02-22 46 views
0

我有標準的一個一對多表設置,但我希望能夠把它映射到一個類結構,看起來像這樣:功能NHibernate - 映射一個一對多的關係,不同的類/實體層次

 
Class 1 -> Mapped to Table 1 (The one- side of the one-to-many relationship) 
    | 
    --- Intermediary class that has additional methods on and has a List of Class 2 
     | 
     ---- Class 2 -> Mapped to Table 2 (The -many side of the relationship) 

這可能與NHibernate?

回答

0

有可能例如

class Class1Map : ClassMap<Class1> 
{ 
    public Class1Map() 
    { 
     Id(x => x.Id); 
     Component(c => 
     { 
      c.Map(x => x.Foo); 
      c.HasMany(x => x.Classes2); 
     }); 
    } 
} 
相關問題