From: shapper on
Hello,

I have the following Linq Query:

public IQueryable<Models.Task>
FindByAppointmentAndUserUsername(DateTime appointment, String
username) {

IQueryable<Models.Task> ts = _context.Tasks.Select(t => new
Models.Task
{
Id = t.Id,
Appointment = t.Appointment,
//Conclusion = t.Conclusion.ToArray(),
//Plan = t.Plan.ToArray(),
User = t.User == null ? new Models.User() : new Models.User
{ Id = t.User.Id, Name = t.User.Name },
Zone = t.Zone
}).Where(t => t.Appointment.Date == appointment.Date &&
t.User.Username == username).OrderBy(t => t.Project);

return ts;
}

This works fine when there are records ... But when there aren't I get
the error:

base {System.SystemException} = {"The member 'User.Username' has no
supported translation to SQL."}

I also get similar error for Conclusion and Plan.

How can I solve this?

Thanks,
Miguel