Linq NH - Combining two expressions

43 views
Skip to first unread message

Roberto

unread,
Aug 26, 2011, 3:08:04 AM8/26/11
to nhu...@googlegroups.com
Good morning, with NH 3.1
i'm trying to combine 2 linq expression (  p=>p.Name=="foo"      or   p=>p.Name=="bar")
both Expression<Func<Person,bool>>

I found some implementation of the "combine" function, but if I use Expression.Or for the combining method it give me

Unable to cast object of type 'NHibernate.Hql.Ast.HqlBitwiseOr' to type 'NHibernate.Hql.Ast.HqlBooleanExpression'.

if indeed I use Expression.OrElse, it give me only the second filter, not the or

Roberto

unread,
Aug 26, 2011, 4:00:46 AM8/26/11
to nhu...@googlegroups.com
found the problem. of course i had to imagine it.
the value of the parameters must be putted on an internal scope variable, or the late execution of linq will take only the last value
Reply all
Reply to author
Forward
0 new messages