3
次のSQLクエリをラムダ式IN C#に変換できません。私は参加してみましたが、それは私にエラーを与えます。カスタムオブジェクトの複数のリストにLINQチェック値がありません
SQLクエリがある:私はC#で試してみました
SELECT DISTINCT Customer.* FROM Customer INNER JOIN RouteCustomer ON Customer.CustomerId = RouteCustomer.CustomerId
WHERE
RouteCustomer.RouteId = @RouteId AND
Customer.Inactive = 0 AND
AND
(
(Customer.CustomerId NOT IN (SELECT CustomerId FROM RouteStopScheduleRule WHERE @Date >= EffectiveDate AND Inactive = 0))
OR
(
(Customer.CustomerId IN (SELECT CustomerId FROM RouteStopScheduleRule WHERE @Date >= EffectiveDate AND Inactive = 0 AND WeeklyFrequency = 0))
AND
(Customer.CustomerId NOT IN (SELECT CustomerId FROM RouteStopScheduleRule WHERE @Date >= EffectiveDate AND Inactive = 0 AND WeeklyFrequency != 0))
)
)
コードが
IEnumerable<RouteStopScheduleRule> RSRList1 = App.Database.AllRouteStopScheduleRule.Where(rsr1 => rsr1.EffectiveDate >= Date && rsr1.Inactive == false).AsEnumerable();
IEnumerable<RouteStopScheduleRule> RSRList2 = App.Database.AllRouteStopScheduleRule.Where(rsr2 => rsr2.EffectiveDate >= Date && rsr2.Inactive == false && rsr2.WeeklyFrequency == 0).AsEnumerable();
IEnumerable<RouteStopScheduleRule> RSRList3 = App.Database.AllRouteStopScheduleRule.Where(rsr3 => rsr3.EffectiveDate >= Date && rsr3.Inactive == false && rsr3.WeeklyFrequency != 0).AsEnumerable();
List<Customer> _Result = new List<Customer>();
var _Prelist = App.Database.AllCustomer.Where(c1 => c1.Inactive == false)
.Join(App.Database.AllRouteCustomer.Where(rc1 => rc1.RouteId == RouteId && (rc1.EffectiveDate <= Date && (rc1.ExpiryDate <= Date || rc1.ExpiryDate.Value.AddYears(1) <= Date))),
rc => rc.CustomerId,
c => c.CustomerId,
(rc, c) => new { CustomerId = c.CustomerId })
.Where(x => (!RSRList1.Contains(x.CustomerId)) || (RSRList2.Contains(x.CustomerId) && (!RSRList3.Contains(x.CustomerId))));
であるが、そのすべてのリストRSRList1で私にエラーを与えて、IEnumerableを<としてRSRList2とRSRList3>はdoesnotの定義が含まれています「含む」
私は行方不明ですか?