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:

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

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -