Hello,
When using Skip() and Take() to paginate a view, the result is wrong. After seeing the generated query I could see the problem is because it is using RowNum instead "View"."row_number", for example:
wrong:
WHERE "Project1"."row_number" > 0 AND ROWNUM <= 1
right:
WHERE "Project1"."row_number" > 0 AND "Project1"."row_number" <= 1
How can I solve it?
Thanks,
Murilo.
Skip() and Take() Problem
Re: Skip() and Take() Problem
Code: Select all
using (ALEXSHEntities context = new ALEXSHEntities()) {
var a = context.DEPTVIEWs.OrderBy("it.DEPTNO").Skip(10).Take(10).ToList();
}
Code: Select all
SELECT
"Extent1".DEPTNO,
"Extent1".DNAME,
"Extent1".LOC
FROM (
SELECT
"Extent1".DEPTNO,
"Extent1".DNAME,
"Extent1".LOC, row_number() OVER (ORDER BY "Extent1".DEPTNO ASC) AS "row_number"
FROM ALEXSH.DEPT_VIEW "Extent1"
ORDER BY "Extent1".DEPTNO ASC
) "Extent1"
WHERE "Extent1"."row_number" > 10 AND ROWNUM <= 10
ORDER BY "Extent1".DEPTNO ASC