复杂类型查询有好的优化方法吗 返回
SqlSugar
老数据
1
2505
悬赏:5 飞吻
[SugarTable("Student")]
public class CMStudent : ModelContext
{
public int Id { get; set; }
public string Name { get; set; }
public int SchoolId { get; set; }
[SugarColumn(IsIgnore = true)]
public string SchoolName{get{ return this.SchoolSingle.Name;}}
[SugarColumn(IsIgnore = true)]
public CMSchool SchoolSingle
{
get
{
return base.CreateMapping<CMSchool>().Single(it => it.Id == this.SchoolId);
}
}
}
上面的我查询的List<CMStudent >,数据有50条,则需要将CMSchool去数据库查询50次。效率好低。。有没有好的优化方式呢
热忱回答(1)
-
fate stay night VIP0
2018/6/6没有 性能就join
0 回复