Entity Framework subquery

后端 未结 2 1905
一整个雨季
一整个雨季 2020-12-31 12:35

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

2条回答
  •  别那么骄傲
    2020-12-31 12:55

    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)
    )
    

提交回复
热议问题