views:

6

answers:

0

Say I have two objects, ParentEntity and ChildEntity. When I do a

var query = session.Linq<ParentEntity>();
query.Expand("ChildEntity");

understandably, it would cause duplicate entries to appear in ParentEntity.

The way I've been handling this is like this.

query.ToList().Distinct();

where I force a query using ToList and then filter the objects by selecting only distinct entities. Does anyone have another approach for this? I don't feel like this is the right approach, since ToList() forces an eager load for the query and then I'll distinct only after the duplicate items have been fetched.