【问题标题】:DbExpressionBinding requires an input expression LINQDbExpressionBinding 需要输入表达式 LINQ
【发布时间】:2021-10-12 08:08:13
【问题描述】:

我试过这个查询:

var a  = (from q in dtRe
          from p in q.Pro
          where motsE.All(word => p.Title.Contains(word))
          select q);

但我有一个错误:

DbExpressionBinding 需要一个带有集合 ResultType 的输入表达式。 Nom du paramètre : 输入

请注意,IQueryable<uio> 类型的 dtResult 和 p 的类型为 ICollection<prop>,这是一个字符串数组 motsCt

【问题讨论】:

    标签: c# .net linq


    【解决方案1】:

    错误是因为我正在传递 wordE ,即带有 , char 的单词,我已将其更改为 wordEtSp 并且它有效!

    【讨论】:

      【解决方案2】:

      尝试添加.ToList()

      var a  = (from q in dtRe.ToList()
            from p in q.Pro
            where WordEt.All(word => p.Title.Contains(word))
            select q);
      

      【讨论】:

      • 当我添加 ToList() 时需要花费时间,因为我在 dtResult 中有 239.000 条记录,并且查询计数的结果 = 0;
      • dtResult.AsEnumerable()怎么样
      • 是的,它可以工作,但 count = 0,我需要在最后做 asquerable 因为我需要一个变量 asquerable 在我的算法之后
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-13
      • 1970-01-01
      • 2019-11-06
      • 1970-01-01
      相关资源
      最近更新 更多