映射集合

时间:2011-07-15 06:20:03

标签: c# nhibernate orm

我有两张桌子:

Table_A (Id1 PK, Id2)

Table_B (Id1 PK, Id2 PK, Id3 PK)

目标:

NHibernate中的table_b行集合映射为table_a对象中的集合

<set name="Table_B_elements" table="Table_B" lazy="true">
                <key columns="Id1"/>
                <one-to-many class="Handler"/>
</set>

我可以轻松地进行类似

的查询
select *
from Table_A as a
join Table_B as b on b.Id1 = a.Id2;

有关如何映射的任何建议吗?

1 个答案:

答案 0 :(得分:0)

呀。根据您真正想要选择的内容,阅读http://nhibernate.info/doc/nh/en/index.html#mapping-declaration-join或此处http://nhibernate.info/doc/nh/en/index.html#collections-mapping。 这些是nHibernate的绝对基础。我建议先阅读文档,然后再问。