Example.

The entity contains a follow records:

  1. "Some text"; 1
  2. "Some text"; 1
  3. "Some text"; 2
  4. "Some text"; null
  5. "Other text"; 1
  6. "Other text"; null

Then i try to select records with Distinct() method.

var distinct = (from a in session.Query.All<MyEntity>()
               select new
               {
                    a.Text,
                    TstInt = a.TstInt == null ? true : a.TstInt == 1 ? true : false 
               }).Distinct();

And result is incorrect. If i use ToArray() before Distinct() result is correct. What does it mean? And why this happened? sample: click for download.

asked Apr 18 '11 at 06:34

Fateev%20Anton's gravatar image

Fateev Anton
5112

edited Apr 18 '11 at 06:55

Hello Anton,

Could you please specify which version of DataObjects.Net and which data provider you use. The answer should be posted as a comment to this one.

Thanks

(Apr 18 '11 at 06:37) Dmitri Maximov Dmitri%20Maximov's gravatar image

DataObjects.Net 4.4.0 and sqlserver provider. I add the sample!

(Apr 18 '11 at 06:43) Fateev Anton Fateev%20Anton's gravatar image

OK, I'll check this.

BTW, the sample is not accessible.

(Apr 18 '11 at 06:46) Dmitri Maximov Dmitri%20Maximov's gravatar image

I hope now works.

(Apr 18 '11 at 06:47) Fateev Anton Fateev%20Anton's gravatar image

Yes, works fine. Thanks.

(Apr 18 '11 at 07:02) Dmitri Maximov Dmitri%20Maximov's gravatar image

I testted it now, and bug is also in "in-memory" internal DO4 provider. It returns this:

Some text True
Some text False
Some text True
Other text True
Other text True

And it should returns:

Some text True
Some text False
Other text True
(Apr 18 '11 at 07:10) Peter Šulek Peter%20%C5%A0ulek's gravatar image

It should return 3 records, i think :

Some text True
Some text False
Other text True

(Apr 18 '11 at 07:20) Fateev Anton Fateev%20Anton's gravatar image

The bug is confirmed. To be fixed.

(Apr 18 '11 at 07:37) Dmitri Maximov Dmitri%20Maximov's gravatar image

Sorry, 3 records is correct, just copied wrong text ;-)

(Apr 18 '11 at 07:42) Peter Šulek Peter%20%C5%A0ulek's gravatar image

Hi! Do you have any progress to this problem?

(Sep 18 '12 at 04:25) k_v_kuznetsov k_v_kuznetsov's gravatar image

Unfortunately, no.

(Sep 18 '12 at 09:13) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Bug created 4 years ago, it's time to fix it!

(May 27 '15 at 07:40) pil0t pil0t's gravatar image

One Answer:

Hello everyone.

I've just checked this case and it's working properly. This issue was fixed.

answered Jun 15 '15 at 11:40

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

Example with bug http://pastebin.com/1ak4ciUq

(Jun 17 '15 at 07:31) pil0t pil0t's gravatar image

Thanks, pilot. I'll reopen investigation.

(Jun 18 '15 at 06:21) Alexey Kulakov Alexey%20Kulakov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA