开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜