I have this fairly simple SQL query :
SELECT i.IdItem
FROM Item i
INNER JOIN Size s ON i.IdItem = s.IdItem
WHERE s.Width > 0 AND s.Width < 100
… which I’ve been trying to translate to LINQ to entities, to no avail.
So far this is what I came up with :
context.Items.Where(i => i.Sizes.Where(s => s.Width > 0 && s.Width < 100))
I have a DbSet in my DatabaseContext (context) for both Items and Sizes, my Item entity has a Sizes navigation property.
This doesn’t compile, giving me a Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'bool' error. I have a feeling I’m missing something really obvious here.
Wheregives you anIEnumerablewhich cannot be used as a condition