Reputation: 1499
In the following LINQ statement I get the error :
Cannot implicitly convert type 'System.Linq.IQueryable' to 'bool'
The 3rd last line has a blue line under the entire line. Here is the code, I tried various changes, i must be missing something obvious, thanks in advance...
var allWaste = _securityRepository.FindAllWaste(userId, SystemType.W);
var searchResults = (
from s in allWaste
where
(
from x in _db.WasteIndicatorItems
join y in
_db.WasteIndicators
on x.WasteIndicatorId equals y.WasteIndicatorId
join z in
_db.HazardTypes
on y.HazardTypeId equals z.HazardTypeId
where
s.WasteId == x.WasteId
group new { x, z } by new { x.WasteId, z.Hazardous } into g
select new
{
nbrOf = g.Count(),
g.Key.Hazardous
}
).Where(a => a.nbrOf >= 1 && a.Hazardous == false)
select s
).Distinct();
Upvotes: 1
Views: 112
Reputation: 42991
The problem is you have an IQueryable in your where clause.
Try
...where( (from x in _db.WasteIndicators ... ).Any() )...
Or something that returns a boolean.
Upvotes: 1