How can i made a pivot for this

旧街凉风 提交于 2019-12-01 11:20:37

First portion uses your linq-entities provider, but after AsEnumerable it uses Linq to objects in order to return a comma seperated list

I changed the last property to give it an alias

AggregateProperty = xx.Acciones.Aggregate((current, next) => current + ", " + next)

 (from A in db.IndicadorServicioAccion
                            .Include("Accion")
                            .Include("IndicadorServicio")
                            .Include(i => i.IndicadorServicio.Indicador)
                    where
                        A.Usuario.IDUsuario == id
                        && A.Permiso == true
                group A by new { A.IndicadorServicio.Indicador.nombreIndicador, A.IndicadorServicio.Servicio.Descripcion } into ag
                select new
                     {
                        ag.Key.nombreIndicador,
                        ag.Key.Descripcion,
                        Acciones = ag.Select(x => x.Accion.Descripcion) 
                     }).AsEnumerable().Select(xx => new
                     {
                       xx.Descripcion,
                       xx.nombreIndicador,
                       AggregateProperty = xx.Acciones.Aggregate((current, next) => current + ", " + next)
                     });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!