toptensoftware/PetaPoco — pull request #104 by tawman (2012-03-19 20:00:49+00:00)
Title: Add Page<T> override to support user defined SQL for Count and Paging

Added a Page override that accepts Sql objects for the Count and Page queries in order to support scenarios when the SQL to Page cannot be rewritten correctly by PetaPoco.

The use case we encountered was a CTE query involving a UNION that PetaPoco could not rewrite for SQL Server with proper row_number paging syntax. The following gist shows an example how the Page support from this pull request can be called directly from client code: https://gist.github.com/2126002