【发布时间】:2010-03-26 18:51:56
【问题描述】:
我有以下 DataServiceQuery 针对 ADO 数据服务运行(安装了更新以使其像 .net 4 一样运行):
DataServiceQuery<Account> q = (_gsc.Users
.Where(c => c.UserId == myId)
.SelectMany(c => c.ConsumerXref)
.Select(x => x.Account)
.Where(a => a.AccountName == "My Account" && a.IsActive)
.Select(a => a)) as DataServiceQuery<Account>;
运行时出现异常:无法在单个资源上指定查询选项(orderby、where、take、skip)
据我所知,我需要使用包含附加 lambda 表达式 (http://msdn.microsoft.com/en-us/library/bb549040.aspx) 的“SelectMany”版本,但我无法使其正常工作。
有人可以告诉我如何正确构建“SelectMany”调用吗?
感谢您的帮助。
【问题讨论】:
-
我可能错了,因为它是“SelectMany”调用。任何帮助表示赞赏。