var PreGruop = from pre in presale group pre by pre.UserID into dateGroup select new { xl = dateGroup.Sum(x => x.XiaoLiang), zt = dateGroup.Sum(x => x.ZhanTingXiaoLiang), cd = dateGroup.Sum(x => x.ZhanTingXiaoLiang), hy = dateGroup.Sum(x => x.CheDai), ew = dateGroup.Sum(x => x.ErWang), sx = dateGroup.Sum(x => x.XinCheShangXian), jq = dateGroup.Sum(x => x.XinCheJiaoQiangXian), bf = dateGroup.Sum(x => x.XinCheChangXianBaoFei), userName = dateGroup.Select(x => x.User.Name) };
例如上边一个查询 用EF 聚合 得到若干列
现在想根据 传入参数("列名") 从结果中 动态 获取相应的值 如何处理
例如原来 DataTble - DataRow["列名"]