Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 查询嵌套实体集合_C#_Linq_Lambda - Fatal编程技术网

C# 查询嵌套实体集合

C# 查询嵌套实体集合,c#,linq,lambda,C#,Linq,Lambda,有人能帮我吗?我不知道如何只从嵌套实体中选择未删除的卡 var userCardSetList1 = _cardSetRepository.GetMany( x => x.Include(c => c.Card).ThenInclude(ca => ca.CardAnswer), x => x.UserId == UserId && x.IsDel

有人能帮我吗?我不知道如何只从嵌套实体中选择未删除的卡

  var userCardSetList1 = _cardSetRepository.GetMany(
                x => x.Include(c => c.Card).ThenInclude(ca => ca.CardAnswer),
                x => x.UserId == UserId &&
                     x.IsDeleted == false &&
                     x.Card.Any(c => c.IsDeleted == false));

谢谢

Where而不是Any?no,那么我得到了错误运算符“&&&”不能应用于“bool”和“IEnumerable”类型的操作数。我通常创建一个执行递归的助手方法,并从linq调用该方法。@user1861065让我确认,在选定的
CardSet
中,可以有删除的卡,也可以没有删除的卡(列在
属性中)并且您只希望不删除卡?对吗?请使用
!x.IsDeleted
,而不是
==false