return _companyRepository.GetAll().Where(company => company.Id == Id)
.Include(company => company.offices.Where(o => o.IsActive))
.ThenInclude(office => office.People.Where(p => p.IsFired))
.ThenInclude(person => person.Children)
.ToList();
我该如何使用Entity Framework Core获取所有活动办公室中被解雇的员工?
我遇到了以下错误:
“Where”子句在ThenInclude或Include中无效。
company.offices.Where(o => o.IsActive)
office.People.Where(p => p.IsFired)
我知道不能在Include
语句中使用Where
。问题是如何使用Include
子句过滤数据?