所以我尝试按照这个例子在这个 LINQ 查询的 where 子句中有一个子查询。
var innerquery =
from app in context.applications
select new { app.app_id };
IEnumerable<postDatedCheque> _entityList = context.postDatedCheques
.Where(e => innerquery.Contains(e.appSancAdvice.application.app_id));
目标是从应用程序表中具有app_id的postDatedCheckes中选择那些记录。
但是我在 where 子句中遇到了以下错误:
- 委托“System.Func”不接受 1 个参数
- 无法将 lambda 表达式转换为类型“字符串”,因为它不是委托类型
- “System.Linq.IQueryable”不包含“包含”的定义,并且最佳扩展方法重载“System.Linq.ParallelEnumerable.Contains(System.Linq.ParallelQuery, TSource)”有一些无效参数
- 实例参数:无法从“System.Linq.IQueryable”转换为“System.Linq.ParallelQuery”
我编码不正确是什么?