ZibStack.NET.Query 3.2.4

dotnet add package ZibStack.NET.Query --version 3.2.4
                    
NuGet\Install-Package ZibStack.NET.Query -Version 3.2.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZibStack.NET.Query" Version="3.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZibStack.NET.Query" Version="3.2.4" />
                    
Directory.Packages.props
<PackageReference Include="ZibStack.NET.Query" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZibStack.NET.Query --version 3.2.4
                    
#r "nuget: ZibStack.NET.Query, 3.2.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZibStack.NET.Query@3.2.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZibStack.NET.Query&version=3.2.4
                    
Install as a Cake Addin
#tool nuget:?package=ZibStack.NET.Query&version=3.2.4
                    
Install as a Cake Tool

ZibStack.NET.Query

Filter/sort DSL for REST APIs — parses query strings into LINQ expressions that translate to SQL. Zero reflection, compile-time field allowlists via source generation.

Install

dotnet add package ZibStack.NET.Query

When used with ZibStack.NET.Dto, the source generator auto-detects ZibStack.NET.Query and adds filter/sort string parameters to CRUD list endpoints.

Quick Start

// Your model — annotate with [CrudApi] (from ZibStack.NET.Dto) or
// [ImTiredOfCrud] (from ZibStack.NET.UI, generates the full stack including DTOs).
[ImTiredOfCrud(DefaultSort = "Name")]
public partial class Player
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Level { get; set; }
    public string? Email { get; set; }
    public int? TeamId { get; set; }

    [OneToOne]
    public Team? Team { get; set; }
}

That's it. The generated list endpoint now accepts filter and sort query string parameters:

GET /api/players?filter=Level>25,Name=*ski&sort=-Level&page=1&pageSize=20
GET /api/players?filter=Team.Name=Lakers                          # relation → auto JOIN
GET /api/players?filter=(Level>50|Level<10),Team.City=LA          # OR + grouping
GET /api/players?filter=Name=in=Jan;Anna;Kasia                    # IN list

Filter Operators

Operator Token Example SQL
Equals = Name=Jan WHERE Name = 'Jan'
NotEquals != Role!=Admin WHERE Role != 'Admin'
Greater > Level>30 WHERE Level > 30
GreaterEq >= Level>=30 WHERE Level >= 30
Less < Level<50 WHERE Level < 50
LessEq <= Level<=50 WHERE Level <= 50
Contains =* Name=*ski WHERE Name LIKE '%ski%'
NotContains !* Name!*test WHERE Name NOT LIKE '%t%'
StartsWith ^ Name^Jan WHERE Name LIKE 'Jan%'
NotStartsWith !^ Name!^Jan WHERE Name NOT LIKE 'Jan%'
EndsWith $ Name$ski WHERE Name LIKE '%ski'
NotEndsWith !$ Name!$ski WHERE Name NOT LIKE '%ski'
In =in= Name=in=Jan;Anna WHERE Name IN ('Jan','Anna')
NotIn =out= Level=out=10;20 WHERE Level NOT IN (10,20)

Logic & Modifiers

Feature Syntax Example
AND , Level>20,Level<50
OR \| Level>50\|Level<10
Grouping () (Level>50\|Level<10),Name=*ski
Case insensitive /i Name=jan/i
Dot notation Nav.Field Team.Name=Lakers

Sorting

GET /api/players?sort=-Level           # descending
GET /api/players?sort=Name             # ascending
GET /api/players?sort=Name desc        # explicit direction
GET /api/players?sort=-Level,Name      # multi-field
GET /api/players?sort=Team.Name        # sort by relation

Collection Filtering (OneToMany)

Filter by child collection properties using Any, All, or Count:

GET /api/teams?filter=Players.Name=*ski              # Any player name contains "ski" (default)
GET /api/teams?filter=Players.Any.Name=*ski           # Same — explicit Any
GET /api/teams?filter=Players.All.Level>50            # ALL players have Level > 50
GET /api/teams?filter=Players.Count>5                 # Team has more than 5 players
GET /api/teams?filter=Players.Count=0                 # Teams with no players

Syntax: Collection.Property (implicit Any), Collection.Any.Property, Collection.All.Property, Collection.Count. EF Core translates to EXISTS/NOT EXISTS/COUNT subqueries.

Field Projection (select=)

Return only specific fields to reduce payload:

GET /api/players?select=Name,Level                        # flat fields only
GET /api/players?select=Name,Level,Team.Name              # include relation fields
GET /api/players?select=Name,Level,Team.Name,Team.City    # multiple relation fields

Response: { "name": "Jan", "level": 42, "team": { "name": "Lakers", "city": "LA" } }

Standalone Count

Get count without fetching data:

GET /api/players?filter=Level>25&count=true    # → { "count": 42 }
GET /api/players?count=true                     # → { "count": 150 }

[QueryDto] Attribute

Standalone query DSL without CRUD endpoints — use on any model:

[QueryDto(DefaultSort = "Name")]
public partial class Product
{
    public int Id { get; set; }
    public string Name { get; set; } = "";
    public decimal Price { get; set; }

    [OneToOne]
    public Category? Category { get; set; }

    [OneToMany]
    public ICollection<Tag> Tags { get; set; }
}

Generates ProductQuery with ApplyFilter(query, filter?), ApplySort(query, sort?), Apply(query, filter?, sort?), ProjectFields(). Sortable defaults to true — set [QueryDto(Sortable = false)] for endpoints with a fixed result order (analytics, exports).

Standalone Usage

You can use the parser and applier directly without the Dto source generator:

using ZibStack.NET.Query;

var q = new ProductQuery();
var query = dbContext.Products.AsQueryable();

// DSL approach:
query = q.Apply(query, "Price>100,Category.Name=Electronics", "-Price");

// Typed approach (when no DSL string):
var q2 = new ProductQuery { Name = "laptop", SortBy = "Price" };
query = q2.Apply(query);

Documentation

Full documentation: mistykuu.github.io/ZibStack.NET/packages/query/

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.4 98 4/21/2026
3.2.3 92 4/21/2026
3.2.2 90 4/21/2026
3.2.1 90 4/21/2026
3.2.0 96 4/21/2026
3.1.5 94 4/20/2026
3.1.4 102 4/20/2026
3.1.3 104 4/20/2026
3.1.2 99 4/20/2026
3.1.1 92 4/20/2026
3.1.0 95 4/20/2026
3.0.6 94 4/20/2026
3.0.5 90 4/20/2026
3.0.4 89 4/20/2026
3.0.3 93 4/20/2026
3.0.2 91 4/20/2026
3.0.1 95 4/20/2026
3.0.0 100 4/20/2026
2.82.0 91 4/20/2026
2.8.1 93 4/18/2026
Loading failed