我有这个实体框架代码:
repository.GetObjectQuery(Of COUNL1)().
Where(Function(a) a.CDATE >= '2012/01/01' And
a.CDATE <= '2012/12/01' And
COID = 88 ).
GroupBy(Function(m) m.CDATE).
Select(Function(n) New PointXY With {
.Y = n.Sum(Function(k) k.TOTALVH),
.X = n.First().CDATE}).
ToList()
出现此错误:
Only parameterless constructors and initializers are supported in LINQ to Entities.
描述:我想按 CDATE 和 TOTALVH 的总和进行分组,并将其放在 PointXY 类中,像这样
PointXY {.Y = Sum(TOTALVH), .X = CDATE})
sql查询:
SELECT SUM(TOTALVH) AS EXPR1, CDATE
FROM COUNL1
WHERE (CDATE >= '2012/01/01') AND (CDATE <= '2012/12/01') AND (COID = 88)
GROUP BY CDATE
请帮助我,谢谢大家。