To filter the records loaded for a collection (that you access by
navigation, as opposed to querying for the collection elements
directly), you should use the filter feature
(http://nhforge.org/doc/nh/en/index.html#filters).

/Oskar


2013/1/21 Richard <[email protected]>:
> Hi
>
> I want to apply a criteria to some child records that I am fetching. This is
> my query
>
>             var result = (from workItem in session.Query<WorkItem>()
>                               .FetchMany(x => x.Reports)
>                               .ThenFetchMany(y => y.ReportRows.Where(z =>
> z.Student.StudentID == "@111111"))
>                           where workItem.Id == 1
>                           select workItem);
>
> I'm new to LINQ so trying to learn as I go along, but I would have thought
> (he says... :) that the Where clause (z => z.StudentID .....) would allow me
> to limit the 'ReportRow(s)' to just those which have a Student with the ID
> of "@111111".
>
> I think I know how I can do the same query in QueryOver but should I be able
> to do this in LINQ too?
>
> BTW I get this when I try and run it:
>
> System.Reflection.TargetInvocationException: Exception has been thrown by
> the target of an invocation. ---> System.ArgumentException: A fetch request
> must be a simple member access expression; '[100002]' is a
> SubQueryExpression instead.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/BiJYsi9RyY8J.
> 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.

-- 
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