Update demo

This commit is contained in:
sunkaixuan
2022-04-21 17:20:33 +08:00
parent c3d6483efa
commit c3b7a169c8
2 changed files with 8 additions and 3 deletions

View File

@@ -81,9 +81,10 @@ namespace OrmTest
db.ThenMapper(list.Select(it => it.SchoolA), sch =>
{
//参数1: room表关联字段 参数2: school表关联字段 参数3: school当前记录
sch.RoomList = db.Queryable<RoomA>().SetContext(room => room.SchoolId, () => sch.SchoolId, sch).ToList();
sch.TeacherList = db.Queryable<TeacherA>().SetContext(teachera => teachera.SchoolId, () => sch.SchoolId, sch).ToList();
if(sch!=null)
sch.RoomList = db.Queryable<RoomA>().SetContext(room => room.SchoolId, () => sch.SchoolId, sch).ToList();
if (sch != null)
sch.TeacherList = db.Queryable<TeacherA>().SetContext(teachera => teachera.SchoolId, () => sch.SchoolId, sch).ToList();
});