asp.net MVC アプリ内で、ゲストが特定の日付より前に出発するゲスト/クライアントがいる部屋を見つけようとしています。
Client モデル クラスには外部キー RoomId があります。
public class Room
{
public int RoomId { get; set; }
[Display(Name = "Room Name")]
public string Name { get; set; }
public bool Disabled { get; set; }
public List<Client> Clients { get; set; }
}
public class Client
{
public int ClientId { get; set; }
public int RoomId { get; set; }
public string RoomName { get; set; }
public DateTime Arrival { get; set; }
public DateTime Departure { get; set; }
public Room Room { get; set; }
}
私の現在のLinqクエリは次のとおりです。
from r in Rooms
where r.Disabled == false
//where r.Clients.Departure<=DateTime.Parse("2012-07-01")
select new
{
r.Name,
r.Disabled
}
コメント行: //where r.Clients.Departure..... は、LinqPad で次のエラーを表示します。
'System.Data.Linq.EntitySet' には 'Departure' の定義が含まれておらず、タイプ 'System.Data.Linq.EntitySet' の最初の引数を受け入れる拡張メソッド 'Departure' が見つかりませんでした (F4 を押して using を追加します)ディレクティブまたはアセンブリ参照)
Linq 内で、このクエリを実行して Departure date where 句を除外する方法はありますか?
助けてくれてありがとう、
マーク