TailoredApps.Shared.Querying
2.1.0
See the version list below for details.
dotnet add package TailoredApps.Shared.Querying --version 2.1.0
NuGet\Install-Package TailoredApps.Shared.Querying -Version 2.1.0
<PackageReference Include="TailoredApps.Shared.Querying" Version="2.1.0" />
<PackageVersion Include="TailoredApps.Shared.Querying" Version="2.1.0" />
<PackageReference Include="TailoredApps.Shared.Querying" />
paket add TailoredApps.Shared.Querying --version 2.1.0
#r "nuget: TailoredApps.Shared.Querying, 2.1.0"
#:package TailoredApps.Shared.Querying@2.1.0
#addin nuget:?package=TailoredApps.Shared.Querying&version=2.1.0
#tool nuget:?package=TailoredApps.Shared.Querying&version=2.1.0
TailoredApps.Shared.Querying
Contracts for list queries: a query with paging, sorting and a filter object, and a result with one page of
items plus the total count. The package has no dependencies, so the same types can be used in an API contract,
in a service and in the data layer. TailoredApps.Shared.EntityFramework and
TailoredApps.Shared.MediatR.PagedRequest build on these contracts.
Installation
dotnet add package TailoredApps.Shared.Querying
Registration
Nothing to register: the package contains contracts only and has no dependency-injection extension.
Usage
using TailoredApps.Shared.Querying;
public class CustomerFilter : QueryBase
{
public string? NameContains { get; set; }
}
public class CustomerQuery : PagedAndSortedQuery<CustomerFilter>
{
}
public class CustomerPage : IPagedResult<CustomerDto>
{
public ICollection<CustomerDto> Results { get; set; } = new List<CustomerDto>();
public int Count { get; set; } // total number of matching items, not the size of the page
}
Applying a query (EF Core shown; maxPageSize is a limit you choose):
if (query.IsSortingSpecified && query.IsSortBy("Name"))
{
customers = query.SortDir == SortDirection.Desc
? customers.OrderByDescending(c => c.Name)
: customers.OrderBy(c => c.Name);
}
var total = await customers.CountAsync(cancellationToken);
if (query.IsPagingSpecified)
{
var size = Math.Clamp(query.Count!.Value, 1, maxPageSize);
customers = customers.Skip((Math.Max(query.Page!.Value, 1) - 1) * size).Take(size);
}
| Type | Purpose |
|---|---|
QueryBase |
Abstract base class of filter objects |
PagedAndSortedQuery<TQuery> |
Abstract query: Page, Count, SortField, SortDir, Filter, IsPagingSpecified, IsSortingSpecified, IsSortBy(fieldName) |
IPagedAndSortedQuery<TQuery>, IQuery<T> |
The contract of the query and of its filter |
IPagingParameters, ISortingParameters, IQueryParameters |
Read-only views of the paging values, the sorting values, and both |
IPagedResult<T> |
Results (the page) and Count (the total) |
IPagedAndSortedRequest<TResponse, TQuery, TModel> |
Query contract tied to a response type; implemented by MediatR.PagedRequest |
SortDirection |
Undefined = 0, Asc = 1, Desc = 2 |
QueryMap<TDestination, TSource> |
A pair of expressions naming a field of a model and the matching field of an entity |
Good to know
Pageis 1-based.Page,CountandSortDirare nullable;IsPagingSpecifiedrequires bothPageandCount,IsSortingSpecifiedrequires a non-blankSortFieldand aSortDirvalue.IsSortingSpecifiedis alsotrueforSortDirection.Undefined, the enum's zero value.IsSortBycompares field names ignoring case.- Nothing here validates the values: a negative page, a huge page size or an arbitrary sort field pass through
as given. Check them where the query is applied. The paging and sorting extensions of
TailoredApps.Shared.EntityFrameworkdo that forIPagingParametersandISortingParameters. QueryMap<TDestination, TSource>only holds the two expressions; nothing in this package interprets them.
Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on TailoredApps.Shared.Querying:
| Package | Downloads |
|---|---|
|
TailoredApps.Shared.EntityFramework
Package Description |
|
|
TailoredApps.Shared.MediatR.PagedRequest
Package Description |
|
|
TabloRazor.Table.WebApiDataProvider
Blazor Table WebApi Data Provider with usage of TailoredApps.Shared.Querying |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview.2 | 63 | 11/12/2026 |
| 3.0.0-preview.1 | 71 | 11/12/2026 |
| 2.1.0 | 121 | 11/12/2026 |
| 2.0.1 | 114 | 11/12/2026 |
| 2.0.0 | 133 | 11/12/2026 |
| 1.6.0 | 135 | 11/12/2026 |
| 1.4.19 | 554 | 10/26/2026 |
| 1.4.18 | 737 | 10/23/2026 |
| 1.4.17 | 1,073 | 10/6/2026 |
| 1.4.16 | 161 | 9/28/2026 |
| 1.4.15 | 169 | 9/21/2026 |
| 1.4.14 | 187 | 8/20/2026 |
| 1.4.13 | 187 | 8/20/2026 |
| 1.4.12 | 201 | 8/20/2026 |
| 1.4.11 | 189 | 8/7/2026 |
| 1.4.10 | 313 | 7/8/2026 |
| 1.4.9 | 201 | 7/8/2026 |
| 1.4.8 | 206 | 7/6/2026 |
| 1.4.7 | 215 | 5/20/2026 |
| 1.4.6 | 201 | 5/20/2026 |