The following LINQ:
retval = ( from jm in entities.JobMasters
where jm.UserId == userId && jm.IsRemote == false
sel
Don't call ToList on the inner query (the one for JobDetails). The error is "This .ToList method you speak of -- it can't be translated to T-SQL!"
This should work:
retval = ( from jm in entities.JobMasters
where jm.UserId == userId && jm.IsRemote == false
select new JobDto
{
JobMasterId = jm.JobMasterId,
ExternalTaskId = jm.ExternalTaskId,
JobDetails = from jd in entities.JobDetails
where jd.JobMasterId == jm.JobMasterId
select new JobDetailDto { ScreenFieldId = jd.ScreenFieldId, FieldValue = jd.FieldValue }
)
}
).ToList();
Note that you can call ToList on the end of the query, as that part doesn't need to be translated to T-SQL.