mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-25 18:29:13 +08:00
Update demo
This commit is contained in:
@@ -81,8 +81,9 @@ namespace OrmTest
|
||||
db.ThenMapper(list.Select(it => it.SchoolA), sch =>
|
||||
{
|
||||
//参数1: room表关联字段 参数2: school表关联字段, 参数3: school当前记录
|
||||
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();
|
||||
});
|
||||
|
||||
|
||||
@@ -1332,6 +1332,10 @@ namespace SqlSugar
|
||||
}
|
||||
public List<T> SetContext<ParameterT>(Expression<Func<T, object>> thisFiled, Expression<Func<object>> mappingFiled, ParameterT parameter)
|
||||
{
|
||||
if (parameter == null)
|
||||
{
|
||||
return new List<T>();
|
||||
}
|
||||
List<T> result = new List<T>();
|
||||
var entity = this.Context.EntityMaintenance.GetEntityInfo<ParameterT>();
|
||||
var queryableContext = this.Context.TempItems["Queryable_To_Context"] as MapperContext<ParameterT>;
|
||||
|
||||
Reference in New Issue
Block a user