On Aug 21, 8:36 pm, Ayende Rahien <
aye...@ayende.com> wrote:
> (from c in Customers select c.Name).Count() <-- in DB, will return only non
> null results.
Yes, but what's the conclusion?
HQL, like SQL, has count(*), count(all...) and count(distinct). The
LINQ
Count() method has the same semantics as count(*), so this should
always be used. Mapping (... select c.Name).Count() to
count ([all] c.Name) is wrong IMO, because it does not preserve the
semantics of the LINQ statement.
If that's what you want in LINQ, you need to write
(from c in Customers where c.Name != null select c).Count() // or
"select c.Name", same difference
or
(from c in Customers select c.Name).Count(n => n != null)
@Steve: in re-linq, the predicate of Count (predicate) is already
translated to a where clause. The transformation from c.Name to
count(*) should be rather simple. If you find more difficult
structural
translations, we could talk about having them prepared in re-linq.
Cheers,
Stefan