I'm trying to write a query in a c# program that gets all items out of a database where a particular id in that item is contained in a list I have. I also need to join on a few tables..
What I have is:
var data = from a in db.Apples.Where(a => myApples.contains(a.type))
from b in db.Banans where b.Id = a.bananaPair.Id
from c in db.Coconuts where c.Id = c.coconutPair.Id
select new {
apple = a,
bananaName = b.name,
coconutName = c.name,
});
I get an error on "where b.Id = a.bananaPair.Id" that "cannot implicitly convert int to bool". I think I am mixing types.. the first where is a comparison, and the others is a join condition. How can I do both in the query? I need pieces of information from all 3 tables in my select object.
Thanks