c# - Exception in NHibernate query when use Contains -
i have following classes:
class operation {     user user_assignedto;     resourcegroup resourcegroup; }   class resourcegroup {     list<user> userscollection; }   and have method. takes user , returns operations. that:
resourcegroup resourcegroup = null;  query = conn.session.queryover<operation>()         .joinalias(item => item.resourcegroup, () => resourcegroup)         .where(item => item.user_assignedto.id == user.id || resourcegroup.userscollection.contains(userdm));   but have exception
unrecognised method call: system.collections.generic.icollection`1[[mapping.classes.user, mapping.classes, version=1.0.0.0, culture=neutral, publickeytoken=8ab89f53b66a52c3]]:boolean contains      
the contains c# function. in sql use myproperty in (select ...). achieve nhibernate, have in clause , inner select - can use detachedcriteria:
the documentation: 15.8. detached queries , subqueries
there detailed examples how use it:
- detailed how to, , advantages of inner select (e.g. paging)
 - inner select group cluase (e.g. filter select max(id))
 
note: provide more details solution, draft.. problem snippets in question. able use in both parts should have some id (the 1) id selected , 2) id compared). resourcegroup missing id, hard understand how pairing tables behind designed. 
but @ least detachedcriteria concept should give correct direction...
Comments
Post a Comment