This is a migrated thread and some comments may be shown as answers.

Linq 101 Samples

2 Answers 78 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pål
Top achievements
Rank 1
Pål asked on 17 Oct 2011, 01:53 PM
Hi.

I'm testing the 101 Linq samples and found one of them not working as expected.

The test is 'Group By/Having' - 'GroupBy with Conditional Count' (or LinqToOpenAccessGroupBy07)

The function should only count discontinued products, but counts all instead. Exact same result as LinqToOpenAccessGroupBy06.

The linq code is as follows:
public object LinqToOpenAccessGroupBy07()
{
    var q = from p in context.Products
            group p by p.Category.CategoryID into g
            select new
            {
                g.Key,
                NumProducts = g.Count(p => p.Discontinued)
            };
 
    return q.ToList();
}

Thanks

Pål

2 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 18 Oct 2011, 09:38 AM
Hi Pål,

yes, this was indeed an issue; thanks for pointing this out. I've fixed this, and the next version (to be released mid of november) will contain the needed bits.

All the best,
Thomas
the Telerik team

Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

0
Pål
Top achievements
Rank 1
answered on 18 Oct 2011, 11:11 AM
That's great. Thanks

Pål
Tags
LINQ (LINQ specific questions)
Asked by
Pål
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Pål
Top achievements
Rank 1
Share this question
or