NHibernate Restriction.IN doesn't work with IList
We are using NHibernate. Have 2 Classes Parent class which contains IList of Child Classes.
From the table I have to get all the Parents that have certain Child elemnts. My code is as follows:
String[] childs= { "Child1", "Child2" };
ICriteria criteria = Session.CreateCriteria(typeof(**Parent**));
criteria.Add(Restrictions.In("Roles", **childs**));
return c开发者_高级运维riteria.List<Parent>() as List<Parent>;
This is throwing "NHibernate.QueryException : Cannot use collections with InExpression" Error.
Can someone please help.
I believe here is your answer you need add alias to child Cannot use collections with InExpression
精彩评论