Thursday, December 19, 2013

NHibernate: Unrecognised method call:Boolean Contains(Int64)

A colleague asked me for help with a complex NHibernate query. He had written a query using the NHibernate Linq support but when he tried to execute the query, NHibernate complained with the following error message:

‘'Unrecognised method call: System.Int64:Boolean Contains(Int64)”

Let’s have a look at his query first:

It seems that NHibernate cannot translate the Contains() call in a related NHibernate query. To fix this, we switched from the Linq syntax to the QueryOver syntax:

No comments: