0

我有一个 linq 查询,我需要在其中专门进行左连接。但是,当我尝试在查询上提交 lambda Skip 函数时,它会出错并说无法在带有连接的 linq 查询上执行跳过。

这是查询(skip 变量是函数的参数,clientDB 是数据上下文):

            Dim questionsQuery = From helpQuestion As HelpQuestion In clientDB.HelpQuestions _
                             Group Join helpCat As HelpCategory In clientDB.HelpCategories _
                             On helpCat.ROW_ID Equals helpQuestion.CATEGORY_ID Into helpGroup = Group _
                             From helpCategory In helpGroup.DefaultIfEmpty() _
                             Where helpQuestion.DISPLAY_DESK _
                             Order By helpQuestion.ROW_ID Descending _
                             Select helpQuestion.ROW_ID, helpQuestion.EMAIL, helpQuestion.FIRST_NAME, helpQuestion.LAST_NAME, helpQuestion.QUESTION, helpQuestion.CREATED, helpQuestion.RESPONSE, helpCategory.CATEGORY_NAME

        If skip > 0 Then
            questionsQuery = questionsQuery.Skip(skip)
        End If
4

1 回答 1

0

我最终只是使用 questionsQuery.ToList() 将其转换为列表。不是最佳解决方案,因为 ToList 函数将整个结果集返回到内存列表,但它确实有效。

于 2009-11-20T17:17:04.823 回答