A lack of support for LINQ’s Skip has been a huge drawback of the XPO implementation. I am glad to confirm that Skip is finally there. I test it with Microsoft SQL Server 2008 where Skip is evaluated using row_number. For example, a simple query:
is evaluated as
What’s interesting is that skipping throws an exception for an unordered query:
If you think about it, that sounds reasonable as the row_number requires an explicit order.
How’s that possible then that Linq2Sql will not throw an exception for such query? Well, it seems that if the ordering is missing from the query tree, Linq2Sql will …………… .
I am sure the curious reader will find the answer on his/her own.