why doesnt' nhibernate support this "exists in list" syntax ??

Posted by ooo on Stack Overflow See other posts from Stack Overflow or by ooo
Published on 2010-12-31T19:48:01Z Indexed on 2011/01/01 5:54 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

i have the following query and its failing in Nhibernate 3 LINQ witha a "Non supported" exception. Its similar to this question but this question was asked over a year ago so i am positive that the answer is out of date.

My DB tables are:

  1. VacationRequest (id, personId)
  2. VacationRequestDate (id, vacationRequestId)
  3. Person (id, FirstName, LastName)

My Entities are:

  1. VacationRequest (Person, IList)
  2. VacationRequestDate (VacationRequest, Date)

Here is the query that is getting a "Non supported" Exception

 Session.Query<VacationRequestDate>()
   .Where(r => people
     .Contains(r.VacationRequest.Person, new PersonComparer()))
   .Fetch(r=>r.VacationRequest)
   .ToList();

is there a better way to write this that would be supported in Nhibernate?

fyi . .the PersonComparer just compared person.Id

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ