項目我得到了以下文件:獲取列表
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