I have the following classes.
public class Candidate
{
public long Id { get; set; )
public List<JobAssigned> JobAssigned { get; set; }
}
public class JobAssigned
{
public long Id { get; set; }
public List<StageScore> StageScore { get; set; }
public List<CriteriaScore> CriteriaScore { get; set; }
public List<StageComment> StageComment { get; set; }
}
public class StageComment
{
public long Id { get; set; }
public JobAssigned JobAssigned { get; set; }
public long JobAssignedId { get; set; }
public long PipelineStageId { get; set; }
public long CandidateId { get; set; }
public long JobId { get; set; }
public string Comment { get; set; }
}
public class StageScore
{
public long Id { get; set; }
public JobAssigned JobAssigned { get; set; }
public long JobAssignedId { get; set; }
public long Rating { get; set; }
public long PipelineStageId { get; set; }
public long CandidateId { get; set; }
public long JobId { get; set; }
}
public class CriteriaScore
{
public long Id { get; set; }
public JobAssigned JobAssigned { get; set; }
public long JobAssignedId { get; set; }
public long Rating { get; set; }
public long PipelineStageCriteriaId { get; set; }
public long CandidateId { get; set; }
public long JobId { get; set; }
}
I want eager load all the related table at once. I was trying to the followning,
List<Candidate> candidate = _context.Candidates.
Include(f => f.JobAssigned.Select(g => g.StageScore))
.OrderBy(x => x.Id).ToList();
When I did .Select().Select()
it was giving an error. How to get all the collections in a single query?