Nhibernate linq group by duplicate fields

Posted by jaspion on Stack Overflow See other posts from Stack Overflow or by jaspion
Published on 2010-05-01T13:26:26Z Indexed on 2010/05/01 13:37 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

Hello, I have a simple query like:

from e in endContratoRepository.GetAll()
                                        where e.Contrato.idContrato == contrato.idContrato &&
                                        e.Volume.idVolume == 1 &&
                                        group e by new { e.dpto.idDepartamento, e.centroCusto.idCentroCusto }
                                            into grp
                                            select new Entidade
                                            {
                                                Contagem = grp.Count(),
                                                centroCusto = grp.Key.idCentroCusto,
                                                dpto = grp.Key.idDepartamento
                                            }

and the problem: The fields that are in the group by, are duplicated in the generated query. The fields centroCusto and dpto appears twice, so when I try to get the field centroCusto, I get dpto.

Anyone know how to solve this?

thanks a lot!

© Stack Overflow or respective owner

Related posts about c#

Related posts about nhibernate