下面的查询,我在展开的导航性能,时刻表,它具有与AssociatedListing财产许多到1关系正常工作:过滤一个LINQ/OData的查询在1到许多导航属性
from la in ListingAssociations.Expand("AssociatedListing").Expand("AssociatedListing/Schedules")
where la.ListingId==60
select la
在结果中,我可以看到对应于每个多个附表对象AssociatedListing对象。这很好。
然而,当我尝试在任何附表字段添加过滤器:
from la in ListingAssociations.Expand("AssociatedListing").Expand("AssociatedListing/Schedules")
where la.ListingId==60 && la.AssociatedListing.Schedules.StartDate > DateTime.Today
select la
我得到的错误:
"'System.Collections.ObjectModel.Collection' does not contain a definition for 'StartDate' and no extension method 'StartDate' accepting a first argument of type 'System.Collections.ObjectModel.Collection' could be found...".
所以我想这个问题是起始日期是时间表类的字段,而“时间表”的导航属性为收集时间表对象,因此Schedules.StartDate
没有任何意义。但是,在这种情况下,必须有一些方法来指定过滤器。怎么样?
任何帮助将不胜感激!
不幸的是,Odata/WCF数据服务不支持Any和All。 – skeej 2011-02-18 13:38:07