/// <summary> /// Returns all machineJob entities and their related machines /// </summary> /// <returns></returns> public List <MachineJob> GetAllMachineJobs() { List <MachineJob> machineJobs = null; using (MachineModel model = new MachineModel()) { machineJobs = model.machinejobs.Include(x => x.Machine).ToList(); foreach (MachineJob job in machineJobs) { model.Entry(job).Reference(x => x.Machine).Load(); } } return(machineJobs); }