Linq Join fetch with Stateless Session duplicating roots

Description

Despite the possible solutions, NHibernate can improve at one point. Publishing the constructor QueryableBase<>(IQueryProvider) from NhQueryable<>, and avoiding the contour Expression.Constant(constant) above.

I found that when eager fetching entities like this...

Linq provider is getting three duplicate instances for the same entity and duplicate instances at entity's collections. Explaining these problems:

1 - Entity's collections duplicate instances: I fix this changing my IEnumerable<>s Collections mapping with ".AsSet()" and overwriting .Equals() and .GetHashCode() of entities classes.

2 – Duplicate entitys at Query result: I solve with an injection of a custom QueryProvider, despite this open issue, NH-2890. The new QueryProvider intercepts "Execute(Expression)" call and unify results:

Environment

None

Activity

Show:

Alex Zaytsev 
November 5, 2013 at 8:30 PM

Could you please provide a complete solution with tests? The pull request is better

Duplicate

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created November 5, 2013 at 3:38 PM
Updated September 26, 2014 at 3:09 PM
Resolved September 26, 2014 at 3:09 PM
Who's Looking?