views:

53

answers:

0

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!