我正在尝试向下筛选三个子级别,并仅查找“属性邮件地址.Status == True”的子元素。
它仍然返回PropertyMailingAddress.Status下的False值。
如何将过滤器向下转换为三个级别,然后使用ThenInclude进行嵌套过滤?
类结构是这样嵌套的:
- 属性
- 产权方
- 派对
- PartyMailingAddress
- PropertyMailingAddress <---状态应等于true(状态为== False的任何孙子PropertyMailingAddress节点,应从此嵌套的孙子分支中删除,并保持PropertyMailingAddress节点为True)
-
var result = await propertyRepository.GetAll()
.Include(pm => pm.PropertyParty).ThenInclude(x => x.Party).ThenInclude(x => x.PartyMailingAddress).ThenInclude(x => x.PropertyMailingAddress)
.Where (a=> a.PropertyParty.Any(x=> (x.Party.PartyMailingAddress.Any(z => z.PropertyMailingAddress.Any(h => h.Status.HasValue && h.Status.Value && h.Status == true))))