mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
Code optimization
This commit is contained in:
parent
31743774d7
commit
eeecca7ba2
@ -38,9 +38,9 @@ namespace OrmTest
|
|||||||
db.Queryable<OperatorInfo>()
|
db.Queryable<OperatorInfo>()
|
||||||
.Includes(x => x.Roles).Where(x => x.Roles.Any(z=>z.id==1))
|
.Includes(x => x.Roles).Where(x => x.Roles.Any(z=>z.id==1))
|
||||||
.ToList();
|
.ToList();
|
||||||
db.Queryable<OperatorInfo>()
|
var list=db.Queryable<OperatorInfo>()
|
||||||
.Includes(x => x.Roles).Where(x => x.Roles.Any())
|
.Includes(x => x.Roles).Where(x => x.Roles.Any())
|
||||||
.ToList();
|
.ToListAsync().GetAwaiter().GetResult();
|
||||||
//db.Queryable<OperatorInfo>()
|
//db.Queryable<OperatorInfo>()
|
||||||
// .Includes(x => x.Roles.Where(z=>z.name==x.realname).ToList())
|
// .Includes(x => x.Roles.Where(z=>z.name==x.realname).ToList())
|
||||||
// .ToList();
|
// .ToList();
|
||||||
|
@ -2332,6 +2332,13 @@ namespace SqlSugar
|
|||||||
_InitNavigat(result);
|
_InitNavigat(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
private async Task _InitNavigatAsync<TResult>(List<TResult> result)
|
||||||
|
{
|
||||||
|
if (this.QueryBuilder.Includes != null)
|
||||||
|
{
|
||||||
|
await Task.Run(() => { _InitNavigat(result); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void _InitNavigat<TResult>(List<TResult> result)
|
private void _InitNavigat<TResult>(List<TResult> result)
|
||||||
{
|
{
|
||||||
@ -2366,7 +2373,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
RestoreMapping();
|
RestoreMapping();
|
||||||
_Mapper(result);
|
_Mapper(result);
|
||||||
await Task.Run(() => { _InitNavigat(result); });
|
await _InitNavigatAsync(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user