Entity Framework IQueryable question
I'm trying to get a list of prescriptions from my Patients entity:
kk works, but gg returns an empty list;. Any ideas why this might be happening? I know it's a short snippet, but I figured there would be something obvious I am doing wrong...
Thanks!
var kk = await _context.Patients.Where(p => p.Id == id)
.Include(p => p.Prescriptions)
.ThenInclude(p => p.Medicine)
.Include(p => p.Prescriptions)
.ThenInclude(p => p.Doctor)
.ToListAsync();
var gg = await _context.Patients.Where(p => p.Id == id)
.Include(p => p.Prescriptions)
.ThenInclude(p => p.Medicine)
.Include(p => p.Prescriptions)
.ThenInclude(p => p.Doctor)
.Select(p => new
{
Prescription = p.Prescriptions.Select(p => p.ToDto())
})
.ToListAsync();kk works, but gg returns an empty list;. Any ideas why this might be happening? I know it's a short snippet, but I figured there would be something obvious I am doing wrong...
Thanks!