Hi,
I am trying to execute the following query but I get the wrong results back.
foreach (var item in (from project in db.Projects
where project.Id == pProjectId
from task in project.Tasks
from taskItem in task.TaskItems
where taskItem.Velocities.Count() == 0 // not finished yet
select new
{
ProjectId = pProjectId,
PriorityId = task.Priorities.Id,
TaskId = task.Id,
ResourceId = taskItem.Resources.Id,
EstimatedDuration = taskItem.EstimatedDuration,
TaskItemId = taskItem.Id
}))
{
}
I am trying to generate objects from all the taskItems that don't have velocity related objects. The table structure is that every taskItem may have many velocities. Right before this call I give velocities to some of the items, yet they are not filtered by this where clause. Am I doing something obvious wrong?
Edit: I think (after staring at the code for a while) that I need to specify some kind of grouping. I don't actually require any of the Velocity record details, but rather just a count of them that relate to the taskItems