{"id":37051965,"url":"https://github.com/collenirwin/topage","last_synced_at":"2026-01-14T06:00:09.603Z","repository":{"id":55816709,"uuid":"302987621","full_name":"collenirwin/ToPage","owner":"collenirwin","description":"Tiny paging library for .NET with support for EF Core and EF6","archived":false,"fork":false,"pushed_at":"2021-02-04T17:26:00.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T11:03:26.593Z","etag":null,"topics":["dotnet-standard","entity-framework","entity-framework-core","ienumerable","iqueryable","pagination","paging"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/collenirwin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-10T20:50:43.000Z","updated_at":"2022-06-17T16:37:17.000Z","dependencies_parsed_at":"2022-08-15T07:21:02.731Z","dependency_job_id":null,"html_url":"https://github.com/collenirwin/ToPage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/collenirwin/ToPage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collenirwin%2FToPage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collenirwin%2FToPage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collenirwin%2FToPage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collenirwin%2FToPage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/collenirwin","download_url":"https://codeload.github.com/collenirwin/ToPage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collenirwin%2FToPage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet-standard","entity-framework","entity-framework-core","ienumerable","iqueryable","pagination","paging"],"created_at":"2026-01-14T06:00:08.871Z","updated_at":"2026-01-14T06:00:09.576Z","avatar_url":"https://github.com/collenirwin.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ToPage\n![.NET Core](https://github.com/collenirwin/ToPage/workflows/.NET%20Core/badge.svg)\n\nA tiny paging library for .NET.\n\nThis library contains extension methods for `IEnumerable\u003cT\u003e` and `IOrderedQueryable\u003cT\u003e` types that make it easy to fetch a page of data from them.\n\n## Installation\nPackage | Target | Description\n--- | --- | ---\n[ToPage](https://www.nuget.org/packages/ToPage) | .NET Standard 2.0 | The base library\n[ToPage.EFCore](https://www.nuget.org/packages/ToPage.EFCore) | .NET Core 3.1 | Provides `async` overloads using EF Core's `ToListAsync` and `CountAsync` methods\n[ToPage.EF6](https://www.nuget.org/packages/ToPage.EF6) | .NET Framework 4.7.2 | Provides `async` overloads using EF6's `ToListAsync` and `CountAsync` methods\n\n## Examples\n#### Example projects\n - [Basic](./Basic)\n - [Entity Framework](./EntityFramework)\n\n#### Basic `IEnumerable` example\n```csharp\nvar numbers = Enumerable.Range(1, 10);\nvar page = numbers.ToPage(pageNumber: 1, itemsPerPage: 3);\n\nConsole.WriteLine(string.Join(\", \", page));\n// Output:\n// 1, 2, 3\n```\nIn this example, an `IPage\u003cint\u003e` object is returned from `ToPage`.\nIts only properties are the requested `PageNumber` (1), and the `Items` on the page.\n\n#### Basic `IEnumerable` example with counts\n```csharp\nvar numbers = Enumerable.Range(1, 10);\nvar page = numbers.ToPageWithCounts(pageNumber: 1, itemsPerPage: 3);\n\nConsole.WriteLine($\"Total items: {page.ItemCount}, total pages: {page.PageCount}\");\nConsole.WriteLine(string.Join(\", \", page));\n// Output:\n// Total items: 10, total pages: 4\n// 1, 2, 3\n```\nIn this example, an `IPageWithCounts\u003cint\u003e` object is returned from `ToPage`.\nIt has the same properties as an `IPage\u003cint\u003e`,\nas well as an `ItemCount` and a `PageCount` which are calculated based on the size of the collection and the number of items per page requested.\n\n#### Entity Framework async example\n```csharp\n// Get the 5th page of 20 users ordered alphabetically by Name\nvar page = await context.Users\n    .OrderBy(user =\u003e user.Name)\n    .ToPageAsync(pageNumber: 5, itemsPerPage: 20);\n```\n*Note:* This example uses either the `ToPage.EFCore` or `ToPage.EF6` library (both APIs are the same, choose the one for the EF version you're using).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollenirwin%2Ftopage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcollenirwin%2Ftopage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollenirwin%2Ftopage/lists"}