开发者

Lambda Expression getting all data from object

I have a user task join table - with ria services i go and get the usertaskjoin based on the userId.

UserTaskQueueJoin = new ObservableCollection<UserTaskQueueJoin>( _context.UserTaskQueueJoins);

once i get this UserTaskJoin object I want to then get the tasks from a query im running.

_quer开发者_JAVA百科y = _query.Where(x => UserTaskQueueJoin.Any(t => t.UserTaskQueueJoinID == x.AssignedToTaskQueueID));

UserTaskQueueJoin - UserTaskQueueJoinID, UserID, TaskQueueID

TaskQueue - TaskQueueID, InstitutionId, TaskQueueName

Task - TaskID, TaskQueueID, TaskName

What I ultimately am doing is running a query on the task table to only return items that are within a taskqueue. my first code snippet above gets the taskqueues a user is in..

The query call above is clearly not working. I have tried with a .SelectMany and cannot get that to work.


If your model contains all the appropriate FK-type relationships, it might be as simple as :

_query = _query.SelectMany(x => x.UserTaskQueueJoins.TaskQueues.Tasks);

or even

_query = _query.SelectMany(x => x.TaskQueues.Tasks);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜