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();
How can I get all fired people of all active offices using Entity Framework Core?
I'm getting this error:
Where clause in not valid inside ThenInclude or Include
company.offices.Where(o => o.IsActive)
office.People.Where(p => p.IsFired)
I know I can not use Where
inside Include
. the question is how to filter data with Include
clause?