Won't Fix
Details
Details
Assignee
Unassigned
UnassignedReporter
peter miller
peter millerLabels
Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created October 22, 2012 at 2:24 PM
Updated December 2, 2014 at 10:34 AM
Resolved December 2, 2014 at 10:12 AM
I have the same problem as a user describes here: http://groups.google.com/group/nhusers/browse_thread/thread/6a4c233931dc5eea
I just upgraded to NH 3.2.0GA where previously I was using NH2.2.4 with Linq addin. One feature I had in my old repository was SetResultTransformer(new DistinctRootEntityResultTransformer()) to ensure unique records when I eagerly fetched values using left joins. My Repository exposes IQueryable<T>. In NH 3 I am using Session.Query<T>, but how can I add a ResultTransformer to that?
In NH2 with linq provider I could write
var query = Session.Linq<T>().QueryOptions.RegisterCustomAction(x => x.SetResultTransformer(new DistinctRootEntityResultTransformer()));
That always ensured that the Distinct Results were always applied. This was useful when eagerly fetching a few collections at once (left joins) which produced a Carteasian product.
How could that be done in NH3 with using IQueryable? I know that it could be done with ICriteria but I want to use Linq.
Distinct s not working for this.
Thanks for your help.