I have this line of code that selects a workflow status and then gets the next workflow statuses mapped to it.
status = db.WorkflowStatuses
.Include(x => x.CurrentMappings.Where(y => y.IsActive && y.NextWorkflowStatus.IsActive))
.Include(x => x.CurrentMappings.Select(y => y.NextWorkflowStatus).Where(y => y.IsActive))
.FirstOrDefault(x => x.Id == id);
My question is do I need the second Include since I referenced NextWorkflowStatus in the first Include?
Includerepresents eager loading and eager loading in EF doesn’t support filtering or ordering so your code will not work at all. You cannot useWhereinside include call.