From: shapper on 10 Jun 2010 21:23 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
|
Pages: 1 Prev: Attach DatagridView binding into a pop up Next: Xml serialization |