I will give that a try, but maybe I should be more explicit as to what
I had before and what IDEALLY I was looking for.

In NH2 with linq provider I exposed from my repository...

IQueryable<T> Query
{
        var query = Session.Linq<T>();
        query.QueryOptions.RegisterCustomAction(x =>
x.SetResultTransformer(new DistinctRootEntityResultTransformer()));
        return query;
}

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. I still needed to be
careful regarding large results sets being returned but it was nice
knowing you would always get the distinct results.

Now in NH3 I have this, but would like to still apply the Distinct
transformer if possible.

IQueryable<T> Query
{
        return Session.Query<T>();
}



On Aug 29, 1:00 pm, Diego Mijelshon <[email protected]> wrote:
>   queryable.AsEnumerable().Distinct().ToList()
>
> will get you the same results as
>
>   query.SetResultTransformer(Transformers.DistinctRootEntity).List()
>
>     Diego
>
> On Sun, Aug 29, 2010 at 13:43, MichaelK <[email protected]> wrote:
> > I don't think Distinct() works for what I am talking about. That seems
> > to add the DISTINCT keyword to the SQL command, but using the
> > DistinctRootEntityResultTransformer() used to take that sql result and
> > when hydrating the entities apply the transformer providing only
> > Distinct entries. I see on the IQuery interface there is a
> > SetTransformer method. Can I get from IQuery to IQueryable?
>
> > On Aug 26, 12:23 pm, Diego Mijelshon <[email protected]> wrote:
> > > .Distinct() should do...
>
> > >     Diego
>
> > > On Thu, Aug 26, 2010 at 13:14, MichaelK <[email protected]> wrote:
> > > > Hello,
>
> > > > I just upgraded to NH 3.0.0 Alpha 2 where previously I was using NH
> > > > 2.2.4 with Linq addin. One feature I had in my old repository was a
> > > > 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 so its
> > > > always there?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "nhusers" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<nhusers%[email protected]>
> > <nhusers%[email protected]<nhusers%[email protected]>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to