Entity Framework/Linq to SQL: Skip & Take

后端 未结 6 2465
一个人的身影
一个人的身影 2020-11-27 15:19

Just curious as to how Skip & Take are supposed to work. I\'m getting the results I want to see on the client side, but when I hook up the AnjLab SQL Profiler and look a

6条回答
  •  时光取名叫无心
    2020-11-27 15:34

    As long as you don't do it like queryable.ToList().Skip(5).Take(10), it won't return the whole recordset.

    Take

    Doing only Take(10).ToList(), does a SELECT TOP 10 * FROM.

    Skip

    Skip works a bit different because there is no 'LIMIT' function in TSQL. However it creates an SQL query that is based on the work described in this ScottGu blog post.

    If you see the whole recordset returned, it probably is because you are doing a ToList() somewhere too early.

提交回复
热议问题