Fetch grand chidrens have duplicate rows


#1

Hello,

I am using the following code to fetch chidren & grandchildren collections of parent.
IList parentList = (from mod in Session.Query()
select mod).FetchMany(o => o.Children).ThenFetchMany(o => o.GrandChildren).ToList();

I have set Children & GrandChildren as Bag.
But the Children collection have duplicate data. The Children collection is duplicated as many number of grandchildren.

If I have 1 children and 3 grandchildren. The result of the above code is having 3 children, each children having 3 grandchildren.

Is there any solution to avoid the duplicate children in NHiberate.Linq? How can I get correct children & grandChildren collections?
Thanking you


#2