Files

60 lines
4.8 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/Pagination/IPaginationView.cs
- Common/DTS.CommonCore/Interface/Pagination/IPaginationViewModel.cs
- Common/DTS.CommonCore/Interface/Pagination/IFilterableListView.cs
generated_at: "2026-04-16T02:18:03.956026+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "17272f9179ee1d83"
---
# Pagination
## Documentation: Pagination and Filtering Interfaces
### 1. Purpose
This module defines foundational interfaces for pagination and filtering functionality within the UI layer of the DTS system. Specifically, `IPaginationView` and `IPaginationViewModel` serve as marker interfaces to establish a contract for views and view models that support pagination, inheriting from `IBaseView` and `IBaseViewModel` respectively. Separately, `IFilterableListView` provides an explicit contract for list views that support dynamic filtering by term and tag, with identification via `ListViewId`. These interfaces enable consistent handling of pagination and filtering concerns across UI components, promoting separation of concerns between view logic (`IPaginationView`, `IFilterableListView`) and view model logic (`IPaginationViewModel`).
### 2. Public Interface
- **`IPaginationView`**
*Signature:* `public interface IPaginationView : IBaseView`
*Behavior:* A marker interface indicating that a view supports pagination. It inherits from `IBaseView` (from `DTS.Common.Base`), implying it adheres to base view contracts (e.g., lifecycle, binding context), but adds no additional members itself.
- **`IPaginationViewModel`**
*Signature:* `public interface IPaginationViewModel : IBaseViewModel`
*Behavior:* A marker interface indicating that a view model supports pagination. Inherits from `IBaseViewModel`, implying base view model responsibilities (e.g., state management, command exposure), but adds no additional members.
- **`IFilterableListView`**
*Signature:* `public interface IFilterableListView`
*Behavior:* Defines contract for a list view capable of filtering.
- `void Filter(object tag, string term)`: Applies a filter using a `tag` (e.g., column/field identifier) and `term` (user-provided filter string).
- `void ClearAllFilters()`: Removes all active filters.
- `string ListViewId { get; }`: Unique identifier for the list view instance, used for scoping filters or state.
### 3. Invariants
- `IPaginationView` and `IPaginationViewModel` are *pure marker interfaces*—they impose no runtime behavior beyond inheritance from their respective base interfaces (`IBaseView`, `IBaseViewModel`).
- `IFilterableListView.Filter` must be idempotent or statefully consistent: repeated calls with the same `tag` and `term` should not produce undefined behavior (e.g., duplicate filters), though exact semantics (overwrite vs. append) are not specified.
- `IFilterableListView.ListViewId` must return a non-null, stable identifier for the lifetime of the instance.
- `IFilterableListView.ClearAllFilters()` must reset the views filter state to its unfiltered condition.
- No ordering guarantees are specified for filter application or clearing (e.g., filters may be applied in any sequence).
### 4. Dependencies
- **Dependencies *of* this module:**
- `DTS.Common.Base.IBaseView` (via `IPaginationView`)
- `DTS.Common.Base.IBaseViewModel` (via `IPaginationViewModel`)
- *No other direct dependencies*—interfaces are self-contained.
- **Dependencies *on* this module:**
- UI components implementing pagination (e.g., views/view models for list pages) must implement `IPaginationView`/`IPaginationViewModel`.
- List views requiring filtering capability must implement `IFilterableListView`.
- Likely consumed by higher-level UI frameworks or pagination/filtering services (not visible in source), but such consumers are not declared here.
### 5. Gotchas
- **Ambiguity in `Filter` semantics:** The `tag` parameters type (`object`) and purpose (e.g., enum, string key, or custom identifier) are unspecified. Implementers must infer or document expected usage.
- **No error handling contract:** `Filter` and `ClearAllFilters` have no documented exception behavior (e.g., on invalid `tag` or during filter application).
- **No state introspection:** `IFilterableListView` exposes no way to query current filters (e.g., `GetActiveFilters()`), making debugging or UI state synchronization difficult.
- **Namespace inconsistency:** `IFilterableListView` resides in `DTS.Common.Interface.Pagination`, while `IPaginationView` and `IPaginationViewModel` are in `DTS.Common.Interface` (no `.Pagination` sub-namespace). This may cause discoverability issues.
- **No versioning or extensibility hooks:** Interfaces are minimal and lack extensibility (e.g., no `Version` property or `Try*` patterns), suggesting potential rigidity for future enhancements.
*None identified beyond the above.*