kullanın Queryable.Any<TSource>
:
var topJobs = from j in streetlightDBEntities.Job
let mjobid = from m in streetlightDBEntities.Job.Include("Streetlight")
where m.Streetlight.StreetlightId == j.Streetlight.StreetlightId
orderby m.DateCompleted descending
select m.JobId
where mjobid.Take(5).Contains(j.JobId)
select j.JobId;
var notTopJobs = streetlightDBEntities.Job.Where(c => !topJobs.Contains(c.JobId));
aşağıdaki hata var. Bunun yerine
:
var notTopJobs = streetlightDBEntities
.Job
.Where(c => !topJobs.Contains(c.JobId));
yapın:
var notTopJobs = streetlightDBEntities
.Job
.Where(c => !topJobs.Any(x => x.JobId == c.JobId))
orijinal sorgu için de yapın.
.NET 3.5 veya .NET 4.0'ı mı hedefliyorsunuz? – DamienG
x.JobId içeren .NET 4.0 – Kiddo