in the domain service class there are two entities which I would like to use in join query: WorkerOnMachine {id(int), WorkerId(int), MachineId(int)} and Worker(WorkerId(int), Name(string)...)
I wanted to create a method in domain service class which returned all workers that operate on selected machine (the worker-machine relationships are stored in WorkerOnMachineTable) the following way:
public IQueryable<Worker> GetWorkerByMachineId(int machineId)
{
var joinedTable = from wom in this.ObjectContext.WorkerOnMachine
join w in this.ObjectContext.Worker on wom.WorkerId equals w.Id
where wom.MachineId == machineId
select new { w };
return joinedTable as IQueryable<Worker>;
}
but the method returns an empty list. Does anyone know what is the right way to write the above method in domain service class?
Thank you!