I know that changing the request form causes the Entity Framework to ignore include calls, but there is a way I can get it to load auxiliary properties when I select a lot and a group. In the following example, I want to notify all employees who have a task ordered for a specific period of time. Calling .ToArray () after I just hit the database once, but I do SelectMany and GroupBy in memory. Is there a way to make SelectMany and GroupBy happen on the SQL server and still include the ServiceType, Ship, and Employee data?
Iโm looking for a way to make one SQL call in the database and eventually get a list of employees who have a task for a period of time and the tasks to which they are assigned.
var employeeJobs = DataContext.Jobs. Include("ServiceType"). Include("Ship"). Include("JobEmployees.Employee"). Where(j => j.Start >= now && j.Start <= finish). OrderBy(j => j.Start). ToArray(). SelectMany(j => j.JobEmployees, (j, je) => new { Job = j, Employee = je.Employee }).GroupBy(j => j.Employee);
Adrian brand
source share