Guys I am new to Entity Framework and I\'m having a bt of a problem that I have been trying to solve for quite a while. Basically I have 4 entities: users, groups, books an
I haven't tested it but hopefully it will work.
entities.Books.Where(
b => entities.ReadingList.
Where(rl => rl.GroupId == groupId).
Select(rl => rl.BookId).
Contains(b.BookId)
)
Personally I think there is a better solution(untested of course):
First select from ReadList by GroupdID, then join in books on BookID.
IQueryable<Book> q =
from rl in entities.ReadingList
join b in entities.Books on rl.BookID equals b.BookID
where rl.GroupdID ==groupID
select b;
var books = q.ToList()
Please let me know if you have any issues.