Looks like it. The link provider apparently sees the aggregate
expression as the outer query, but that shouldn't be done that way: the skip
and take expressions are consumed by an expression visitor but the values
they get as parameters should be applied to the query / sequence they work
on, and _that_ sequence is then the source of the aggregate expression,
which always works on a separate scope, so it could never be wrapped by a
take.
FB
That product a very different query, though
That product a very different query, though
On Thu, Jul 22, 2010 at 8:21 PM, Fabio Maulo <fabio...@gmail.com> wrote:
of course the real target is known: it's the result of the Take()
method. Skip & Take are query modifiers, not real query returning methods
('query' in the sense of a select statement). The source of skip is a query,
so skip & take modify that query and it then becomes the source of count.
Same sort of query:
session.Linq<Foo>().Count(c=>c.SomeField=="Bar");
here no skip/take is present, but as these are query modifiers, it's
not really a different construct: you have a query and it's used as the
source of the aggregate.
FB
knowing that the DevExpress' grid with their linqdatasource creates
complex linq queries with much more complex issues than the one you posted,
(like grouping on a constant :)), it's inevitable to simply support these
constructs, otherwise people will simply not use the linq provider (and that
would be a waste of effort).
the query you reported is a valid linq query, it should produce the
query you expected, so I'd opt for filing a bug report, but it's up to Steve
(where's Steve anyway? ;)) if he has time to fix this.
The 'ToList()' workaround is silly really, you don't want to fetch
all data to do an aggregate in-memory
> Should I log this as a bug somewhere??
you can log issues here: http://216.121.112.228
FB
hahaha :D. Trust me, I really had the same reaction initially :)
Especially when I found out my linq provider crashed always, with every
query created by DevExpress' linqdatasource because they were always
grouping on a constant value (e.g. 0).
but what can you do: the user wants to use the grid, the linq
datasource or whtever control the ui control vendor cooks up to produce linq
stuff, and if the o/r mapper doesn't work that way, the user will likely
look elsewhere to use something which does work with the grid. Sadly, o/r
mapper developers are in that tough spot where all the problems of other
people are supposed to be solved. ;).
In the end, it's not that hard really. It's just similar to the
VB.NET stuff: you'll find out along the way, which is of course a sucky
situation, but alas, our destiny as o/r mapper developers ;)
FB
I don't think that's the point. The point is:
1) if NH says it contains a working Linq provider, a user can only assume it
indeed works. If it doesn't, the user can only conclude: the linq provider
doesn't work or has a bug. If a feature hasn't been implemented, the linq
provider is thus incomplete. Unfortunately, an incomplete linq provider is
more a burden than a blessing.
2) if NH wants to be the best o/r mapper out there, a working linq provider
is essential. The main reason is that more and more people will learn about
o/r mapping and learn Linq, how it works etc. as there are many books,
articles written for EF and Linq to SQL and linq itself. If these people
can't use their knowledge with NH, the barrier to accept it as the best
there is is higher.
FB
Gesendet von meinem HTC
----- Ursprüngliche Nachricht -----
Von: Rumen Stankov <rumen....@gmail.com>
Gesendet: Samstag, 31. Juli 2010 16:19
An: nhibernate-development <nhibernate-...@googlegroups.com>
Betreff: [nhibernate-development] Re: Linq-to-NHibernate issue with paging and counts