Problem with Count() for DA for .NET

Hello,

we’re using DA for .NET v8.0.81.1131.

After updating from DA 7 to DA 8 we encountered a problem with aggregate functions using DaLinq.
If we use two GroupJoins/SelectMany in a query and add a Count() we always get a “Undefined column referenced”.
With only one join it works fine.

Here is a snippet of our code to repoduce the issue:

 var count = adapter.GetTable<CadastralUnit>()
                    .GroupJoin(view.GetTable<CadastralDistrict>(),
                               p => p.FKCadastralDistrict,
                               p => p.UID,
                               (p, q) => new
                                          {         
                                              p.FKCadastralDistrict, 
                                              p.FKOwnerAddress, 
                                              p.UID,
                                              q
                                           })
                            .SelectMany(p => p.q.DefaultIfEmpty(),
                                        (p, q) => new
                                                  {
                                                      p.FKCadastralDistrict, 
                                                     p.FKOwnerAddress, 
                                                     p.UID,
                                                    cdUID = q.UID
                                                  })
                            .GroupJoin(view.GetTable<Address>(),
                                       p => p.FKOwnerAddress,
                                       p => p.UID,
                                       (p, q) => new
                                                 {
                                                     p.FKCadastralDistrict,
                                                     p.FKOwnerAddress,
                                                     p.UID,
                                                      p.cdUID,
                                                      q,
                                                 })
                            .SelectMany(p => p.q.DefaultIfEmpty(),
                                        (p, q) => new
                                                  {
                                                      p.FKCadastralDistrict,
                                                      p.FKOwnerAddress,
                                                      p.UID,
                                                      p.cdUID,
                                                      aId = q.UID,
                                                  });
            var c = count.Count();

The query works well with a ToList() but not with Count().

Do you have any idea what is wrong and what we can do?

Sincerly yours
Franz Frey

Hello

Could you provide structure of the data tables involved in this query (via support@ )?

Thanks in advance