私は、SQLite ローカル データベースを使用して Windows Phone 7 アプリケーションに取り組んでいますが、少し固執しています。
いくつかのクラスが定義されており、それぞれにマッピングが設定されており、いくつかのフィルタリングを使用してリストを取得したいと考えています。等しい値をチェックする方法の例はたくさん見つかりましたが、等しくないチェックの例はありません。
CSParameterCollection parameters = new CSParameterCollection();
parameters.Add("@CurrentDate", currentDate);
parameters.Add("@DirectionId", intVisszaut);
CSList<Trip> RouteTrips = Route.Trips.FilteredBy("Services.StartDate <= @CurrentDate and Services.EndDate >= @CurrentDate and Services." + DayOfWeek.ToString() + " = 1 and DirectionId = @DirectionId", parameters);
このフィルターは問題なく動作しますが、次のように更新すると失敗します。
(Services.CalendarDates.Date != @CurrentDate および Services.CalendarDates.Date.ExceptionType != 2)
CSParameterCollection parameters = new CSParameterCollection();
parameters.Add("@CurrentDate", currentDate);
parameters.Add("@DirectionId", intVisszaut);
CSList<Trip> RouteTrips = Route.Trips.FilteredBy("(Services.CalendarDates.Date != @CurrentDate and Services.CalendarDates.Date.ExceptionType != 2) and Services.StartDate <= @CurrentDate and Services.EndDate >= @CurrentDate and Services." + DayOfWeek.ToString() + " = 1 and DirectionId = @DirectionId", parameters);
エラー コードは次のとおりです: タイプ 'System.InvalidCastException' の最初のチャンス例外が Vici.CoolStorage.WP7.dll で発生しました
Services は OneToOne であり、Services.CalendarDates は OneToMany マッピングです。フィルター値を使いすぎていませんか? それとも何か間違っていますか? <> を使用しても機能しません。