google-code-export / dataobjectsdotnet

Automatically exported from code.google.com/p/dataobjectsdotnet
0 stars 0 forks source link

Linq translation error : wrong result count #766

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
заметил странную особенность такой запрос 
выдаёт 30 записей

        from person in Query.All<Person>()
        from personInfo in Query.All<PersonContactInfo>().Where(pi => pi.Person==person).Take(1).DefaultIfEmpty()
        from customer in Query.All<Customer>().Where(c => c.Curator==person).Take(1).DefaultIfEmpty()
        where customer!=null
        select
          ....

а такой 0
        from person in Query.All<Person>()
        from personInfo in Query.All<PersonContactInfo>().Where(pi => pi.Person==person).DefaultIfEmpty()
        from customer in Query.All<Customer>().Where(c => c.Curator==person).Take(1).DefaultIfEmpty()
        where customer!=null
        select
          ....
[22.07.2010 10:56:53] Alex Ilyin: может быть, всё 
нормально, на всякий случай написал
[22.07.2010 11:05:32] Alex Ilyin: м ещё баг...
     var query =
        from person in Query.All<Person>()
        from personInfo in Query.All<PersonContactInfo>().Where(pi => pi.Person==person).Take(1).DefaultIfEmpty()
        from customer in Query.All<Customer>().Where(c => c.Curator==person).Take(1).DefaultIfEmpty()
        where customer!=null
        select
          new CustomerCuratorListItemDto {
            ID = person.Id,
            Email = personInfo.Email,
            Icq = personInfo.ICQ,
            Name = personInfo.Email,
            Phone = personInfo.Phone,
            Skype = personInfo.Skype
          };

возвращает 30 запией при этом query.Count() 
возвращает 0

Original issue reported on code.google.com by alexis.k...@gmail.com on 23 Jul 2010 at 5:45

GoogleCodeExporter commented 9 years ago

Original comment by alexis.k...@gmail.com on 23 Jul 2010 at 8:47