我在使用 LINQ 为域服务调用中的查询设置 where 子句时遇到问题。
如果我没有设置 where 子句,它工作得很好,我会在我完成的事件中得到我的结果(我只为完成的事件实现了事件处理程序来证明我的问题)。
LoadOperation<User> load =
_Context.Load(_Context.GetUsersQuery());
load.Completed += (se, ea) =>
MyList.ItemsSource = load.Entities.FirstOrDefault();
如果我在查询中添加 where 子句,我只会得到一个空列表。并且 where 子句应该返回 1 行 :)
LoadOperation<User> load =
_Context.Load(_Context.GetUsersQuery().Where(f => f.UserID == UserID));
load.Completed += (se, ea) =>
MyList.ItemsSource = load.Entities.FirstOrDefault();
对于任何反馈,我们都表示感谢!