Skip to content

Data Models Reference

RzR edited this page Jul 4, 2026 · 2 revisions

Data Models Reference

This page is the field-by-field reference for the request and response models exposed by the PagedListResult.DataModels package (assembly RzR.ResultMessage.Pagination.Abstractions). Every other layer of the library, from the EF Core extensions to the ASP.NET Core binders, is built on top of these shapes.

All types live under RzR.ResultMessage.Pagination.Abstractions.*. The package targets netstandard2.0 and has no runtime dependencies beyond the standard library and RzR.ResultMessage.

Request models

PagedRequest

The base request used by every paginated endpoint.

Property Type Default Description
Page int 1 1-based page index. Validated by [Range(1, int.MaxValue)].
PageSize int 10 Number of items per page. Validated by [Range(1, int.MaxValue)]. The Web layer additionally caps it by MaxPageSize.
Search DataSearchDefinition new instance Free-text search settings. See below.
Order DataOrderDefinition new instance Sorting settings. See below.
Fields ICollection<string> empty HashSet Optional list of property names to project; the library will reduce the response payload to those fields (handy for stored-procedure projections and column toggles).
PredefinedRecord DataPredefinedFilterDefinition new instance Identifiers of records to be pinned at the top of the result.

All members are virtual, so you can derive your own request type and override defaults or add custom annotations.

PageRequestWithFilters

Extends PagedRequest and adds the filter pipeline. Implements IValidatableObject, which means MVC will surface model-level validation errors automatically when filters are malformed.

Property Type Default Description
Filters ICollection<DataFilter> empty HashSet Top-level filter expressions. The behavior of the collection depends on which GetPagedWith* overload is called; see EntityFramework Core Extensions.

DataFilter

A single filter entry. Implements IValidatableObject.

Property Type Description
FilterValue DataFilterValue Required. The actual condition (property + operator + value).
FilterApplyOrder int Required. Determines the order in which filters are applied. Lower values are applied first.
Dependencies ICollection<DataFilterDependence> Optional. Sub-conditions linked to the parent via AND/OR (only used by GetPagedWithFiltersAsync).

DataFilterValue

Describes the condition itself. Implements IValidatableObject.

Property Type Description
Condition FilterType The operator. Defaults to Equals.
PropertyName string Required. The property to filter on.
Values ICollection<string> Required for most conditions. For IsIn/IsNotIn all entries are used; for Between the first entry is the lower bound; for IsNull/IsNotNull the collection is ignored.
CompareValue string Used as the upper bound by Between.

Validation rules enforced by Validate(...):

  • PropertyName must be present.
  • Condition must be set.
  • Between requires CompareValue.
  • Conditions other than IsNull/IsNotNull require at least one value.
  • Multiple Values are only valid for IsIn and IsNotIn.

DataFilterDependence

A child condition attached to a parent DataFilter.

Property Type Description
ParentFilterLinkType FilterConditionType And or Or. Determines how this dependency combines with the parent.
FilterValue DataFilterValue The dependency's condition.

DataOrderDefinition

Property Type Default Description
OrderByProperty string null Property name to order by.
OrderDirection OrderDirection Asc Asc or Desc.
OrderByDefaultProperty bool false If true and OrderByProperty is empty, the library looks for a property decorated with [PaginationDefaultOrderProperty] and orders by it. If neither is present, the query is left in its natural order (the EF Core extensions append OrderBy(_ => 0) to keep Skip/Take deterministic).

DataSearchDefinition

Property Type Default Description
Search string null The free-text search term. Empty/null means "no search".
SearchInAllTextFields bool true When true, the term is matched against every string property of the entity.
SearchInAllFields bool false When true, the search engine is allowed to attempt matching across all properties (including non-string ones). Mutually exclusive with SearchInAllTextFields semantically; the Web binder uses `searchAll=true
CustomSearchTextProperties ICollection<string> empty When neither "all text" nor "all" mode is set, the search is restricted to this list.

Convenience method SetCustomSearchProperties(IEnumerable<string>) clears SearchInAllTextFields and assigns the list in one call.

DataPredefinedFilterDefinition

Property Type Description
PredefinedFieldName string Property to match against. If empty, the library falls back to the property decorated with [PaginationDefaultTopRecordPrimaryKey] or to the entity's primary key (resolved through DefaultPrimaryKeyDefinition).
PredefinedRecords ICollection<string> Identifiers (string-encoded) of the rows to pin at the top of the result.

Breaking change history: in v3 the property was renamed from PredefinedRecords (a flat collection on PagedRequest) to PredefinedRecord (an object with two members). See Migration Guide.

DefaultPrimaryKeyDefinition

Helper passed to GetPaged* to tell the predefined-records pipeline which property carries the entity key.

Property Type Description
DefaultPrimaryKey string Property name to use when PredefinedFieldName is missing.
FindByAttribute bool If true, the resolver will look up the property decorated with [PaginationDefaultTopRecordPrimaryKey].
FindByEntity bool If true, the resolver will probe the EF Core model and use the entity's primary key.

Constructors: parameterless, single-string, and full triple (string, bool, bool).

Result models

PagedResult<TSource>

Generic envelope returned by every paged operation. It extends Result<IList<TSource>> from RzR.ResultMessage and implements IPagedResult<TSource>.

Property Type Description
CurrentPage int 1-based current page.
PageCount int Total number of pages.
PageSize int Page size used to compute the slice.
RowCount int Total filtered rows (before paging).
HasPreviousPage bool Derived (defaults to CurrentPage > 1). Setter is intentionally idempotent: it only stores an explicit override when it disagrees with the derived value.
HasNextPage bool Derived (defaults to CurrentPage < PageCount). Same idempotency rule as above.
Response IList<TSource> The actual page items. Annotated with [XmlArray] for SOAP/XML serialization.
ExecutionDetails PagedExecDetailsResult Wall-clock execution metadata.
IsSuccess bool Inherited from Result<T>. The library sets it to true after building the response.
Messages IList<MessageModel> Inherited from Result<T>. Filled with validation/error messages on failure.

The class also exposes Map<TDestination>(IEnumerable<TDestination>), which clones the envelope but swaps the response items. Useful when the database query returned entities and you want to project to a DTO without losing the paging metadata.

PagedExecDetailsResult

Property Type Description
ExecutionTimeMs long Elapsed milliseconds. -1 means "not measured".
ExecutionDate DateTime? Server-side timestamp captured when the response was built.

The setters are private. Use SetExecutionTimeMs(long, DateTime) if you need to amend the values from custom decorators. The Web layer reads ExecutionTimeMs to populate the optional Server-Timing: paged;dur=<ms> header.

IPagedResult<TSource>

Lightweight contract you should rely on in interfaces and method signatures (preferred over the concrete PagedResult<T> to make testing and mocking easier). Members mirror the concrete class.

public interface IPagedResult<TSource> : IResult<IList<TSource>>
    where TSource : class
{
    int CurrentPage { get; set; }
    int PageCount { get; set; }
    int PageSize { get; set; }
    int RowCount { get; set; }
    bool HasPreviousPage { get; set; }
    bool HasNextPage { get; set; }
    PagedExecDetailsResult ExecutionDetails { get; set; }
}

Enums

FilterType

Located in RzR.ResultMessage.Pagination.Abstractions.Enums. The numeric values are the declaration order (default integer enum).

Member Notes
Equals Property == value.
NotEquals Property != value.
StartsWith Case-insensitive string.StartsWith.
DoesNotStartWith Negated StartsWith.
EndsWith Case-insensitive string.EndsWith.
DoesNotEndsWith Negated EndsWith.
Contains Case-insensitive string.Contains.
SensitiveContains Case-sensitive Contains.
DoesNotContains Case-insensitive negated Contains.
SensitiveDoesNotContains Case-sensitive negated Contains.
GreaterThan >.
GreaterThanOrEquals >=.
LessThan <.
LessThanOrEquals <=.
Between Two-bound inclusive range; uses Values[0] and CompareValue.
IsIn Multi-value Contains (set membership).
IsNotIn Multi-value negated Contains.
IsNull Value-less; checks for null.
IsNotNull Value-less; checks for non-null.

FilterConditionType

public enum FilterConditionType { And, Or }

Used for filterLink (between top-level filters) and for DataFilterDependence.ParentFilterLinkType.

OrderDirection

public enum OrderDirection { Asc, Desc }

JSON examples

The model serializes to a fully self-describing JSON shape. The same payload is produced regardless of the target framework.

Request

{
  "page": 1,
  "pageSize": 10,
  "search": {
    "search": "string",
    "searchInAllTextFields": true,
    "searchInAllFields": false,
    "customSearchTextProperties": [ "string" ]
  },
  "order": {
    "orderByProperty": "string",
    "orderDirection": 0,
    "orderByDefaultProperty": false
  },
  "fields": [ "string" ],
  "predefinedRecord": {
    "predefinedFieldName": "string",
    "predefinedRecords": [ "string" ]
  },
  "filters": [
    {
      "filterValue": {
        "condition": 0,
        "propertyName": "string",
        "values": [ "string" ],
        "compareValue": "string"
      },
      "filterApplyOrder": 0,
      "dependencies": [
        {
          "parentFilterLinkType": 0,
          "filterValue": {
            "condition": 0,
            "propertyName": "string",
            "values": [ "string" ],
            "compareValue": "string"
          }
        }
      ]
    }
  ]
}

Response

{
  "currentPage": 1,
  "pageCount": 0,
  "pageSize": 10,
  "rowCount": 0,
  "executionDetails": {
    "executionTimeMs": 0,
    "executionDate": "yyyy-MM-ddTHH:mm:ss.fff"
  },
  "response": [],
  "isSuccess": true,
  "messages": []
}

Clone this wiki locally