The CascadePaginator class is an abstract base class designed to handle paginated retrieval of model data from a CascadeDataLayer. This class provides mechanisms to query, clear, and manage state associated with pagination such as the highest page queried and whether the last page has been fully loaded.
More...
|
| | CascadePaginator (CascadeDataLayer cascade, object criteria, string collectionPrefix, int perPage, IEnumerable< string >? populate=null, int? freshnessSeconds=null, int? populateFreshnessSeconds=null, bool? hold=null, bool localOnly=false) |
| | CascadePaginator Constructor.
|
| string | CollectionName (int page) |
| | Constructs a collection name for a given page number by appending it to the CollectionPrefix.
|
|
async Task< bool > | HasAnyPageExpired () |
| async Task< IEnumerable< Model > > | Query (int page, int? freshnessSeconds=null) |
| | Queries a specific page of data using the CascadeDataLayer and updates the state regarding loaded pages.
|
|
async Task< IReadOnlyList< IReadOnlyList< Model > > > | QueryAllPages (int? freshnessSeconds=null) |
|
async Task< IReadOnlyList< IReadOnlyList< Model > > > | GetAllCached () |
|
async Task< int?> | HighestPageNumberInCache () |
|
async Task | Clear () |
| | Clears the cached data in the collections for all the queried pages. Resets the highest queried page and last page loaded status.
|
| async Task | Refresh (int freshnessSeconds=0) |
| | Refreshes the cached data in the collections for all the queried pages with a specified freshness. The method is currently commented out but indicates where the logic would ordinarily be implemented.
|
| async Task | Prepend (Model newDocket) |
| | Inserts a new model item at the beginning of the collection for the first page. Adjusts the first page's collection to include the new item.
|
|
| static string | CollectionNameForPage (string collectionPrefix, int page) |
| | Constructs the collection name for a given prefix and page number, matching the format used internally per page.
|
|
| object | AddPaginationToCriteria (object criteria, int page) |
| | Adds pagination parameters to the criteria to filter query operations. Must be implemented by derived classes.
|
|
|
CascadeDataLayer | Cascade [get] |
| | The CascadeDataLayer from which data is queried.
|
|
object | Criteria [get] |
| | Criteria used to filter the data during queries.
|
|
string | CollectionPrefix [get] |
| | A prefix used to construct unique collection names associated with each page of data.
|
|
int | PerPage [get] |
| | The number of items to be fetched per page.
|
|
int | HighestPage = -1 [get, protected set] |
| | The highest page number that has been successfully queried.
|
|
bool | LastPageLoaded [get, protected set] |
| | Indicates whether the last page of the dataset has been fully loaded.
|
|
bool | Loading [get, protected set] |
| | Indicates whether a query operation is currently in progress.
|
|
bool | LocalOnly [get, protected set] |
| | When true, queries are answered only from the local cache (no origin request).
|
|
int? | FreshnessSeconds [get, protected set] |
| | Time in seconds for considering the freshness of the data queried.
|
|
int? | PopulateFreshnessSeconds [get, protected set] |
| | Time in seconds for considering the freshness of any populated data.
|
|
IEnumerable< string >? | Populate [get, protected set] |
| | Fields or relationships to be populated during query operations.
|
The CascadePaginator class is an abstract base class designed to handle paginated retrieval of model data from a CascadeDataLayer. This class provides mechanisms to query, clear, and manage state associated with pagination such as the highest page queried and whether the last page has been fully loaded.
◆ AddPaginationToCriteria()
| object Buzzware.Cascade.CascadePaginator< Model >.AddPaginationToCriteria |
( |
object | criteria, |
|
|
int | page ) |
|
abstractprotected |
Adds pagination parameters to the criteria to filter query operations. Must be implemented by derived classes.
- Parameters
-
| criteria | The original query criteria before pagination is applied. |
| page | The current page number to be applied for pagination. |
- Returns
- An object representing the modified criteria with pagination included.
◆ CascadePaginator()
| Buzzware.Cascade.CascadePaginator< Model >.CascadePaginator |
( |
CascadeDataLayer | cascade, |
|
|
object | criteria, |
|
|
string | collectionPrefix, |
|
|
int | perPage, |
|
|
IEnumerable< string >? | populate = null, |
|
|
int? | freshnessSeconds = null, |
|
|
int? | populateFreshnessSeconds = null, |
|
|
bool? | hold = null, |
|
|
bool | localOnly = false ) |
|
inline |
CascadePaginator Constructor.
- Parameters
-
| cascade | The CascadeDataLayer object for data operations. |
| criteria | Criteria object for filtering data in queries. |
| collectionPrefix | Prefix for the collection names for each page. |
| perPage | Number of items per page to be retrieved. |
| populate | Optional; fields to populate during query. |
| freshnessSeconds | Optional; time in seconds for data freshness consideration. |
| populateFreshnessSeconds | Optional; time in seconds for population data freshness. |
| hold | Optional; indicator to hold paginator operations. |
| localOnly | Optional; when true, queries are answered only from the local cache. |
◆ CollectionName()
| string Buzzware.Cascade.CascadePaginator< Model >.CollectionName |
( |
int | page | ) |
|
|
inline |
Constructs a collection name for a given page number by appending it to the CollectionPrefix.
- Parameters
-
| page | The page number for which the collection name is being constructed. |
- Returns
- The constructed collection name including the page number formatted with leading zeros.
◆ CollectionNameForPage()
| string Buzzware.Cascade.CascadePaginator< Model >.CollectionNameForPage |
( |
string | collectionPrefix, |
|
|
int | page ) |
|
inlinestatic |
Constructs the collection name for a given prefix and page number, matching the format used internally per page.
- Parameters
-
| collectionPrefix | The collection prefix. |
| page | The page number. |
- Returns
- The collection name including the page number formatted with leading zeros.
◆ Prepend()
| async Task Buzzware.Cascade.CascadePaginator< Model >.Prepend |
( |
Model | newDocket | ) |
|
|
inline |
Inserts a new model item at the beginning of the collection for the first page. Adjusts the first page's collection to include the new item.
- Parameters
-
| newDocket | The new instance of Model to be prepended to the collection. |
◆ Query()
| async Task< IEnumerable< Model > > Buzzware.Cascade.CascadePaginator< Model >.Query |
( |
int | page, |
|
|
int? | freshnessSeconds = null ) |
|
inline |
Queries a specific page of data using the CascadeDataLayer and updates the state regarding loaded pages.
- Parameters
-
| page | The page number of the data to be queried. |
- Returns
- An IEnumerable of Model containing the data for the specified page.
◆ Refresh()
| async Task Buzzware.Cascade.CascadePaginator< Model >.Refresh |
( |
int | freshnessSeconds = 0 | ) |
|
|
inline |
Refreshes the cached data in the collections for all the queried pages with a specified freshness. The method is currently commented out but indicates where the logic would ordinarily be implemented.
- Parameters
-
| freshnessSeconds | The freshness parameter indicating the number of seconds for the data to consider being fresh on query. |
The documentation for this class was generated from the following file:
- Buzzware.Cascade/CascadePaginator.cs