想象一下这种情况:
var locations = from Locations in this.LocationDataContext.Locations
.Include("ChildLocations")
where
(Locations.LocationType.ID == 3)
select
Locations;
此查询将加载类型 == 3 的所有位置以及所有相关的子位置,好的。但我想弄清楚的是如何过滤正在加载的子位置。如果位置有 300 万个子位置怎么办?
也许是这样的?(不起作用,因为 ChildLocations 是一组实体)
var locations = from Locations in this.LocationDataContext.Locations
.Include("ChildLocations")
where
(Locations.LocationType.ID == 3) &&
(Locations.ChildLocations.LocationType.ID == 2)
select
Locations;
谢谢你。