项目我得到了以下文件:获取列表
public class TreeNode
{
string Id;
string Owner; //"users/1"
string TodoListId; //"todolists/1"
string ParentId; //"treenodes/1"
}
public class TodoList
{
string Id;
List<TodoItem> Items;
}
public class TodoListItem
{
bool IsCompleted;
}
我如何可以获取当前用户的所有项目已没有完成?我应该重新设计任何文件吗?
我想是这样的:
from all treenodes belonging to the current user
load all todolists
and return all active items within those lists
但一个服务器往返
更新在2
这里是我试图用两个查询(不支持的SelectMany)做:
var todoListIds = _dbSession.Query<UserTreeNode>()
.Where(x => x.UserId == user.Id)
.Select(x => x.TodolistId);
var nodes = _dbSession.Query<Todolist>()
.Where(x => x.Id.In(todoListIds))
.SelectMany(x => x.Items.Where(item => !item.IsCompleted));
请问'TodoList'有'TodoList's的'List'? – Default 2012-04-25 10:57:26
todolistitem和todolist之间的关系是什么?列表项目中是否有错字? –
daryal
2012-04-25 10:58:10
不清楚这里介绍的所有这些类型之间的关系。 Con提供一些与问题代码相关的内容。 – Tigran 2012-04-25 11:01:41