Page 1 of 1

Distinct().Count() returns incorrect value

Posted: Tue 28 Apr 2009 10:36
by dilbert
I'm currently using dotConnect for MySQL 5.20 Beta

I get incorrect value when trying to execute .Distinct().Count() expression.
Here is an example:

Code: Select all

            var query = DB.UserExamSubscriptions.Select(u => u.Id_user).Distinct();
            int count = query.Count();   
            
            int realCount = 0;
            foreach (int id in query)
            {
                realCount++;
            }

            // count == 1        (incorrect)
            // realCount == 488  (correct)
Count() method returns correct value if it is used without Distinct() method. But if they are used together, return value is always 1.

Thank you for your help in advance.

Posted: Wed 29 Apr 2009 08:32
by AndreyR
Thank you for the report, we have reproduced the problem and now we are fixing it.
I will let you know as soon as the fix is available.

Posted: Thu 07 May 2009 12:48
by AndreyR
The problem is fixed, look forward to the next build.