Is there an update on this? I running into the same problem with the
latest NH 3.0-CR1.

Thanks!
Meir


On Nov 11, 5:39 am, Stefan Wenig <[email protected]> wrote:
> I created an issue for re-linq:https://www.re-motion.org/jira/browse/RM-3474
>
> When this is implemented, upgrading NH to the latest build of re-linq
> should handle your queries as expected.
>
> HTH,
> Stefan
>
> On 5 Nov., 12:21, John Surcombe <[email protected]> wrote:
>
> > Using NH3 beta 2, I'm trying to do a SELECT where the WHERE clause
> > contains a subquery, as follows:
>
> > --------------
> > var ordersSubQuery = from o in Sess.Query<Order>()
> >    where o.Customer.Id == 12345
> >    select o;
>
> > var firstLines = from l in Sess.Query<Line>()
> >    where ordersSubQuery.Contains(l.Order)
> >       && l.LineNumber == 1
> >    select l;
>
> > var results = firstLines.ToList();
> > --------------
>
> > This executes, but it returns the first line of every order in the
> > database, not just those for the customer with Id 12345.  In other
> > words, the where clause in ordersSubQuery gets ignored.
>
> > However, if I dispense with the separate ordersSubQuery variable, and
> > write the subquery inline, like this, then it works:
>
> > --------------
> >  var firstLines = from l in Sess.Query<Line>()
> >    where (from o in Sess.Query<Order>()
> >       where o.Customer.Id == 12345
> >       select o).Contains(l.Order)
> >       && l.LineNumber == 1
> >    select l;
>
> > var results = firstLines.ToList();
> > --------------
>
> > I know there are lots of other ways I can do this - like using
> > QueryOver instead.  However, I'm most interested to know why the first
> > approach doesn't work? Is it possible that it will be supported in
> > future? Or am I hitting some limitation of LINQ here?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to