Created
November 1, 2017 13:17
-
-
Save dataneek/d703587a1e13d86328c7977cb859309c to your computer and use it in GitHub Desktop.
Example of PaginableCollections and Dapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var connection = connectionFactory.GetConnection()) | |
{ | |
using(var reader = | |
connection.QueryMultiple("<stored procedure>", new { }, CommandType.StoredProcedure)) | |
{ | |
var metadata = reader.Read<Metadata>().First(); | |
var items = reader.Read<Foo>(); | |
return | |
new StaticPaginable<Foo>( | |
items, | |
metadata.PageNumber, | |
metadata.ItemCountPerPage, | |
metadata.TotalItemCount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment