# hesamkashefi/paginationhelper architecture

> Architecture diagram of the GitHub repository hesamkashefi/paginationhelper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hesamkashefi/paginationhelper
- Repository: https://github.com/hesamkashefi/paginationhelper

## Overview

PaginationHelper is a .NET API pagination library. An API caller supplies an ordered query or enumerable and page parameters to IPageHelper; PageHelper selects a page, optionally projects records, counts the total, and returns an envelope with paging metadata and navigation links. The library also provides dependency-injection setup and configurable defaults. The README documents the caller workflow; sampled implementation shows the helper’s internal behavior. External framework and mapping dependencies are shown only where their use is explicit.

Main entry points: [`PaginationHelper/PageHelper.cs`](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/PageHelper.cs) (Page Helper), [`PaginationHelper.Core/Pagination.cs`](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Pagination.cs) (Navigation Links), [`PaginationHelper.Core/Meta.cs`](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Meta.cs) (Response Metadata), [`PaginationHelper/IPageHelper.cs`](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/IPageHelper.cs) (Helper Contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["API Integration"]
  node_registration["Service Registration"]
  node_helper_contract["Helper Contract<br/>[IPageHelper.cs]"]
end

subgraph group_processing["Pagination Processing"]
  node_page_params["Page Parameters<br/>[PaginationDto.cs]"]
  node_page_helper["Page Helper<br/>[PageHelper.cs]"]
  node_page_config["Page Configuration<br/>[PageConfig.cs]"]
end

subgraph group_response["Response Model"]
  node_pager_stats["Page Statistics<br/>[Pager.cs]"]
  node_link_metadata["Navigation Links<br/>[Pagination.cs]"]
  node_response_meta["Response Metadata<br/>[Meta.cs]"]
  node_envelope["Response Envelope<br/>[Envelope&#123;T&#125;.cs]"]
end

node_api_caller(("API Caller"))
node_source_data[("Ordered Data")]
node_mapper["AutoMapper"]
node_url_services["ASP.NET URL Services"]

node_api_caller -->|"calls"| node_helper_contract
node_api_caller -->|"supplies query"| node_source_data
node_api_caller -->|"supplies parameters"| node_page_params
node_registration -->|"registers"| node_helper_contract
node_registration -->|"registers implementation"| node_page_helper
node_page_helper -->|"implements"| node_helper_contract
node_page_helper -->|"reads"| node_page_params
node_page_helper -->|"uses defaults"| node_page_config
node_page_helper -->|"pages and counts"| node_source_data
node_page_helper -->|"projects records"| node_mapper
node_page_helper -->|"builds links"| node_url_services
node_page_helper -->|"computes statistics"| node_pager_stats
node_page_helper -->|"creates links"| node_link_metadata
node_page_helper -->|"builds metadata"| node_response_meta
node_page_helper -->|"returns envelope"| node_envelope
node_pager_stats -->|"provides page counts"| node_link_metadata
node_link_metadata -->|"populates links"| node_response_meta
node_response_meta -->|"included in"| node_envelope

click node_page_params "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/PaginationDto.cs"
click node_registration "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/PaginationHelperExtensions.cs"
click node_helper_contract "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/IPageHelper.cs"
click node_page_helper "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/PageHelper.cs"
click node_page_config "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/PageConfig.cs"
click node_pager_stats "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Pager.cs"
click node_link_metadata "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Pagination.cs"
click node_response_meta "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Meta.cs"
click node_envelope "https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Envelope%7BT%7D.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registration,node_helper_contract toneBlue
class node_page_params,node_page_helper,node_page_config,node_source_data toneAmber
class node_pager_stats,node_link_metadata,node_response_meta,node_envelope,node_api_caller toneMint
class node_mapper,node_url_services toneIndigo
```

## Components

### API Integration

- [Service Registration](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/PaginationHelperExtensions.cs): `PaginationHelper/PaginationHelperExtensions.cs`
- [Helper Contract](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/IPageHelper.cs): `PaginationHelper/IPageHelper.cs`

### Pagination Processing

- [Page Parameters](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/PaginationDto.cs): `PaginationHelper.Core/PaginationDto.cs`
- [Page Helper](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper/PageHelper.cs): `PaginationHelper/PageHelper.cs`
- [Page Configuration](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/PageConfig.cs): `PaginationHelper.Core/PageConfig.cs`

### Response Model

- [Page Statistics](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Pager.cs): `PaginationHelper.Core/Pager.cs`
- [Navigation Links](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Pagination.cs): `PaginationHelper.Core/Pagination.cs`
- [Response Metadata](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Meta.cs): `PaginationHelper.Core/Meta.cs`
- [Response Envelope](https://github.com/hesamkashefi/paginationhelper/blob/master/PaginationHelper.Core/Envelope%7BT%7D.cs): `PaginationHelper.Core/Envelope{T}.cs`

### Other components

- **API Caller**
- **Ordered Data**
- **AutoMapper**
- **ASP.NET URL Services**

## Connections

- API Caller → Helper Contract: calls (evidence: `README.md`)
- API Caller → Ordered Data: supplies query (evidence: `README.md`)
- API Caller → Page Parameters: supplies parameters (evidence: `README.md`)
- Service Registration → Helper Contract: registers (evidence: `PaginationHelper/PaginationHelperExtensions.cs`)
- Service Registration → Page Helper: registers implementation (evidence: `PaginationHelper/PaginationHelperExtensions.cs`)
- Page Helper → Helper Contract: implements (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Page Parameters: reads (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Page Configuration: uses defaults (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Ordered Data: pages and counts (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → AutoMapper: projects records (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → ASP.NET URL Services: builds links (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Page Statistics: computes statistics (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Navigation Links: creates links (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Response Metadata: builds metadata (evidence: `PaginationHelper/PageHelper.cs`)
- Page Helper → Response Envelope: returns envelope (evidence: `PaginationHelper/PageHelper.cs`)
- Page Statistics → Navigation Links: provides page counts (evidence: `PaginationHelper/PageHelper.cs`)
- Navigation Links → Response Metadata: populates links (evidence: `PaginationHelper/PageHelper.cs`)
- Response Metadata → Response Envelope: included in (evidence: `PaginationHelper.Core/Envelope{T}.cs`)
