The LINQ expression 'DbSet()
.GroupJoin(
inner: DbSet()
.Where(v => v.EndDate < __now_0 || v.EndDate == null && (int?)v.OrgAuditState == (int?)已通过),
outerKeySelector: user => (Guid?)user.Id,
innerKeySelector: record => record.TraineeId,
resultSelector: (user, recordsMap) => new UserRecordDto{
Id = user.Id,
CreatedOn = user.CreatedOn,
Unionid = user.Unionid,
OpenId = user.OpenId,
Name = user.Name,
Sex = user.Sex,
Nation = user.Nation,
Political = user.Political,
Phone = user.Phone,
DeptId = user.DeptId,
DeptCode = user.DeptCode,
PostRank = user.PostRank,
UnManageRank = user.UnManageRank,
Birthday = user.Birthday,
WorkUnit = user.WorkUnit,
Job = user.Job,
Days = recordsMap
.AsQueryable()
.Sum(v => v.Days),
DeductDays = recordsMap
.AsQueryable()
.Sum(v => v.DeductDays),
ActualDays = recordsMap
.AsQueryable()
.Sum(v => v.ActualDays)
}
)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
var data = (from d in db.Set()
join u in db.Set()
on d.Id equals u.DeptId into usersMap
select new
{
Deptname = d.Name,
count = usersMap.Count(),
d.Code
}).ToArray();
The LINQ expression 'DbSet()
.GroupJoin(
inner: DbSet()
.Where(v => v.EndDate < __now_0 || v.EndDate == null && (int?)v.OrgAuditState == (int?)已通过),
outerKeySelector: user => (Guid?)user.Id,
innerKeySelector: record => record.TraineeId,
resultSelector: (user, recordsMap) => new UserRecordDto{
Id = user.Id,
CreatedOn = user.CreatedOn,
Unionid = user.Unionid,
OpenId = user.OpenId,
Name = user.Name,
Sex = user.Sex,
Nation = user.Nation,
Political = user.Political,
Phone = user.Phone,
DeptId = user.DeptId,
DeptCode = user.DeptCode,
PostRank = user.PostRank,
UnManageRank = user.UnManageRank,
Birthday = user.Birthday,
WorkUnit = user.WorkUnit,
Job = user.Job,
Days = recordsMap
.AsQueryable()
.Sum(v => v.Days),
DeductDays = recordsMap
.AsQueryable()
.Sum(v => v.DeductDays),
ActualDays = recordsMap
.AsQueryable()
.Sum(v => v.ActualDays)
}
)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.