下面的查詢,我在展開的導航性能,時刻表,它具有與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