我想做的是在linq查询中使用group by,但是我真的不知道正确的语法是什么,因此语法正确:
当前代码:
public List<Section> getSectionsClass()
{
var context = GetDbContext();
return (from cs in context.contenido_seccion
join c in context.clase on cs.materiaId equals c.materiaId
group cs by cs.id into gr
select new Section()
{
Name = cs.nombre,
Id = cs.id,
IdClass = c.id
}
).ToList();
}
在gr
中的select
之后出现错误,错误内容如下:
Ambiguos invocation