views:

130

answers:

0

If I have a parent and child modelled relationship. How to I select the parent, and some of the child rows. I cannot seem to do it, and load the parent object.

var query =
(
    from parent in Parents.Include("Children")
        from child in parent.Children
            where child.Date == parent.Children.Max(x => x.Date)
            select parent
);

the problem is that the parent is returned multiple times, not the parent with the children loaded.

Is there any way to populate each of the parents, and include the child rows, but only the ones needed. If I try and navigate again, I get all the children, not just the ones with the latest date.