Given this inheritance mapping:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="User" table="[User]" abstract="true">
<joined-subclass name="SubUser1" table="SubUser1">
<key column="UserId" />
...
</joined-subclass>
<joined-subclass name="SubUser2" table="SubUser2">
<key column="UserId" />
...
</joined-subclass>
<joined-subclass name="SubUser3" table="SubUser3">
<key column="UserId" />
...
</joined-subclass>
</class>
</hibernate-mapping>
how do I query for all instances of SubUser2
and SubUser3
? I realize I can do this:
session.Linq<User>().OfType<SubUser2>()
but that only allows me to filter by a single type. I tried this:
session.Linq<User>().Where(user => user is SubUser2)
but that resulted in this error:
could not resolve property: of: User
Any ideas on how to express a query against multiple sub-types?