Linq to Sql 包括 2 个子集

本文关键字:子集 包括 to Sql Linq | 更新日期: 2023-09-27 18:35:18

使用实体框架 6.

我有一个城市类,其中包含一个核心类的集合。每个CoreClass都有一个CorePerson和CoreBooks的集合。想想"学校"模式。

要在我使用的查询中包含 CoreBooks,请执行以下操作:

.Include(e=>e.CoreClass.Select(i=>i.CoreBooks))

但是我如何获得核心人员的人员记录:

 .Include(e=>e.CoreClass.Select(i=>i.CorePersons.Person?????))

Linq to Sql 包括 2 个子集

.Include(e=>e.CoreClass.Select(i=>i.CoreBooks))
.Include(e=>e.CoreClass.Select(i=>i.CorePersons.Select(o => o.Person)))