Is Linq Group By still not supported or I'm doing something wrong ?

My linq is :
          var q = from p in session.Query<Product>()
                        group p by p.Category into g
                        select new { Category = g.Key, TotalValue =
g.Sum(p => p.UnitsInStock * p.Price) };

Witch is converted to the following SQL :
         select category1_.Id as col_0_0_,
                 cast(sum(product0_.UnitsInStock*product0_.Price) as
DOUBLE PRECISION) as col_1_0_,
                 category1_.Id as Id0_,
                 category1_.Name as Name0_
         from [Product] product0_
                 left outer join [Category] category1_ on
product0_.Category_id=category1_.Id
         group by category1_.Id

Because category1_.Name isn't in the group by clause this generates an
SqlException.

Is this a known bug ? Is there a workaround ?

This linq works well in EF 4

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