次のクエリは、 AssociatedListingプロパティと多対1の関係にあるナビゲーション プロパティSchedulesを展開した場合に正常に機能します。
from la in ListingAssociations.Expand("AssociatedListing").Expand("AssociatedListing/Schedules")
where la.ListingId==60
select la
結果には、各AssociatedListingオブジェクトに対応する複数のScheduleオブジェクトが表示されます。これはいい。
ただし、スケジュールフィールドのいずれかにフィルターを追加しようとすると、次のようになります。
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' には 'StartDate' の定義が含まれておらず、タイプ 'System.Collections.ObjectModel.Collection' の最初の引数を受け入れる拡張メソッド 'StartDate' が見つかりませんでした...」.
問題は、StartDateがScheduleクラスのフィールドであり、「 Schedules」ナビゲーション プロパティがScheduleオブジェクトのコレクションであるSchedules.StartDate
ため、意味をなさないことだと思います。しかし、この多対 1 の状況でフィルターを指定する何らかの方法が必要です。どのように?
どんな助けでも大歓迎です!