Ok, I think I see what you mean. List and IList are pretty much the
same, since both List<T> and ICollection<T> define Contains() as
instance methods. IEnumerable would be different, because it would
call the extension method Enumerable.Contains (this source, value).

A LINQ provider probably would not notice the difference between List
and IList unless it checks the methods' defining types, but
IEnumerable is different. A provder can choose to implement either
one, both, or neither.

re-linq helps with this too: it can "normalize" all of these calls to
special expression nodes, since the difference between them is usually
not significant and just causes work in the parser.

Currently, re-linq does this for IEnumerable, but not for List and
ICollection. I created a ticket: https://www.re-motion.org/jira/browse/RM-3340
The ticket also says how to do that yourself in the mean time (you
only need to register these methods, not implement the normalization).
In NH, that'd be in NhRelinqQueryParser.cs

Cheers,
Stefan

On Sep 22, 12:56 pm, Fabio Maulo <[email protected]> wrote:
> List<int> ids = new List<int> {1,2,3};
> var entitiesQuery = from e session.Query<MyEntity> where ids.Contains(e.Id);
>
> will generate a different tree than
> IList<int> ids = new List<int> {1,2,3};
> var entitiesQuery = from e session.Query<MyEntity> where ids.Contains(e.Id);
>
> On Wed, Sep 22, 2010 at 6:46 AM, Stefan Wenig <[email protected]>wrote:
>
>
>
>
>
> > From a LINQ point of view, there's only IQueryable and IEnumerable,
> > IQueryable being preferred in overloads since it's more specific.
> > Concrete types make no difference.
>
> > But maybe I misunderstood. Can you provide an example?
>
> > On Sep 22, 11:30 am, Fabio Maulo <[email protected]> wrote:
> > > Ah... in this case items should be a List not a IList nor ICollection...
> > > I'm not sure but seems that using interfaces re-linq generates a
> > different tree.
>
> > > --
> > > Fabio Maulo
>
> > > El 22/09/2010, a las 06:23, Stefan Wenig <[email protected]>
> > escribió:
>
> > > > PS: if that's not supported, you can also try
> > > > var score = from s in NHibernateSession.Linq<Score>()
> > > >   where items.Contains (s.Item)
> > > >   select s;
>
> > > > On Sep 22, 11:03 am, Stefan Wenig <[email protected]> wrote:
> > > >> This would be the correct code:
>
> > > >> IList<Item> item = FromSomeSource();
> > > >> var score = from s in NHibernateSession.Linq<Score>()
> > > >>    join i in items on s.Item equals i
> > > >>   select s;
>
> > > >> Looks weird, but the thing is:
> > > >> - If you have a query source and join an in-memory collection to it,
> > > >> you create a query that receives the collection.
> > > >> - If you have an in-memory collection and join a query to it, the
> > > >> query is executed and then joined to the collection.
> > > >> Don't know if NH's LINQ provider supports this though (re-linq does).
>
> > > >> Technically, the reason is the parameter list of Queryable.Join:
> > > >> IQueryable<TOuter>, IEnumerable<TInner>. One could just create a new
> > > >> extension method that supports the other way too, but I'd be careful
> > > >> with that kind of ideas ;-)
>
> > > >> Cheers,
> > > >> Stefan
>
> > > >> On Sep 22, 12:02 am, Scott <[email protected]> wrote:
>
> > > >>> Can someone tell me why when I use the NHibernate Linq inhibitor it
> > > >>> gets the entire table when I trace it in Sql Profiler and if I use it
> > > >>> in the from it gets the entire table 1 record at a time.
>
> > > >>> Simple query
>
> > > >>> IList<Item> item = FromSomeSource();
> > > >>> var score = (from i in items
> > > >>>   join s in NHibernateSession.Linq<Score>() on i equals s.Item
> > > >>>   select s);- Hide quoted text -
>
> > > >> - Show quoted text -
>
> > > > --
> > > > 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 athttp://
> > groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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.
>
> --
> Fabio Maulo- Hide quoted text -
>
> - Show quoted text -

-- 
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