在 LINQ to Entities 查询中无法构造实体或复杂类型
var res = (from a in db.sg
join b in db.cg
on a.code equals b.code into res
from x in res.DefaultIfEmpty()
select x)
.Where(x=>x.code=="123").ToList()
.Select(r=>new ClassModel
{
code = x?.code,
name = x?.name,
sginfo = db.sg.Where(s=>s.id==r.id).ToList()
}).ToList();