【发布时间】:2012-09-05 15:31:05
【问题描述】:
我正在尝试使用 NHibernate 过滤器来过滤父类的属性,但我不断收到 multi-part identifier "Parent.Active" could not be bound.我的过滤器定义是:
<filter-def name="useActive" />
我的父类在映射中有这个:
<property name="Active">
<column name="ACTIVE" not-null="true" />
</property>
<bag name="Children" table="CHILDREN" inverse="true">
<key>
<column name="PARENT_ID_IN_CHILD" />
</key>
<one-to-many class="ChildType" />
</bag>
我的子班在映射中有这个:
<many-to-one name="Parent" class="ParentTyle">
<column name="PARENT_ID_IN_CHILD" />
</many-to-one>
<filter name="useActive" condition="Parent.Active = 1" />
如何让 NHibernate 在过滤时检查父列?
编辑:我正在使用mySession.EnableFilter("useActive"); 启用过滤器。我也在使用 LINQ-to-NHibernate,但我认为这并不重要。
【问题讨论】:
标签: nhibernate nhibernate-mapping linq-to-nhibernate