这是我失败的代码
var query = from gg in Client.wcf.context.Good
from cc in Client.wcf.context.Customer
from ch in Client.wcf.context.CashHeading
from cs in Client.wcf.context.Cash
where ch.Id_customer == cc.Id
where cs.Id_cashheading == ch.Id
where gg.Id == cs.Id_good
select new CustomerOrderResult {
CustomerID = cc.Id,
Price = gg.Price.HasValue ? gg.Price.Value : 0,
Date = ch.Date.HasValue ? ch.Date.Value : DateTime.Now
};
List<CustomerOrderResult> qqq = query.ToList();
其他信息:方法&#39;选择&#39;不受支持。
查询是另一个linq,它的WCF数据客户端到服务器(实体)应用程序的完整源文件是Here, on GitHub
其他linq查询工作正常
错误:+ query {Error translating Linq expression to URI: The method 'Select' is not supported.} System.Linq.IQueryable<CustomerOrderResult> {System.Data.Services.Client.DataServiceQuery<CustomerOrderResult>.DataServiceOrderedQu
ery}
答案 0 :(得分:1)
可能query
包含null
。尝试
where x != null && x.CustomerID == c.Id