流畅的NHibernate - 将一对多关系映射到不同的类/实体层次结构

时间:2013-02-22 10:04:13

标签: nhibernate-mapping fluent-nhibernate-mapping

我有标准的一对多表设置,但我希望能够将它映射到类似这样的类结构:

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有可能吗?

1 个答案:

答案 0 :(得分:0)

有可能例如

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