Common.QueryKit
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Common.QueryKit --version 1.0.2
NuGet\Install-Package Common.QueryKit -Version 1.0.2
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="Common.QueryKit" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Common.QueryKit" Version="1.0.2" />
<PackageReference Include="Common.QueryKit" />
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 Common.QueryKit --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Common.QueryKit, 1.0.2"
#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 Common.QueryKit@1.0.2
#: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=Common.QueryKit&version=1.0.2
#tool nuget:?package=Common.QueryKit&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Here is a ready-to-use, clean README.md file content optimized for GitHub.
You can copy-paste it directly, or save it as README.md.
# Common.QueryKit
**Lightweight • EF Core–safe • Dynamic query composition library**
Build powerful, fully SQL-translatable filters, sorts & paging on `IQueryable<T>`
Perfect for enterprise ASP.NET Core apps:
ERP systems • School Management • Admin Panels • Reporting APIs
## ✨ Highlights
- 100% **SQL-translatable** (no client evaluation)
- Nested properties support (`"Class.GradeLevel"`, `"Address.City.Country"`)
- Strongly-typed `FilterOperator` enum
- Multi-column sorting with direction control
- Range filtering (`Between`), `In`, null checks
- **Property whitelisting** for security
- Clean & simple pagination
- Minimal footprint, predictable performance
## 📦 Installation
```bash
dotnet add package Common.QueryKit
🚀 Quick Start
var request = new QueryRequest
{
Filters = new List<FilterRule>
{
new() { Property = "FullName", Operator = FilterOperator.Contains, Value = "john" },
new() { Property = "BirthDate", Operator = FilterOperator.Between, From = new DateTime(2000,1,1), To = new DateTime(2010,12,31) },
new() { Property = "Status", Operator = FilterOperator.In, Values = new[] { "Active", "Pending" } }
},
Sorts = new List<SortRule>
{
new() { Property = "Class.Name" },
new() { Property = "CreatedAt", Descending = true }
},
Page = 1,
PageSize = 25
};
// One-liner
var students = await dbContext.Students
.Apply(request)
.ToListAsync();
Or more control:
var query = dbContext.Students
.ApplyFilters(request.Filters)
.ApplySorting(request.Sorts)
.PageBy(request.Page, request.PageSize);
🔧 Supported Operators
| Operator | Description | Value Type(s) |
|---|---|---|
Equals |
== | any |
NotEquals |
!= | any |
Contains |
string contains | string |
StartsWith |
starts with | string |
EndsWith |
ends with | string |
GreaterThan |
> | number, DateTime, etc. |
GreaterThanOrEqual |
≥ | number, DateTime |
LessThan |
< | number, DateTime |
LessThanOrEqual |
≤ | number, DateTime |
Between |
value between From ↔ To | number, DateTime |
In |
value in collection | any (array/list) |
NotIn |
value not in collection | any (array/list) |
IsNull |
is null | — |
IsNotNull |
is not null | — |
🛡️ Property Whitelisting (Strongly Recommended)
var allowed = new PropertyWhitelist(
"Id", "FullName", "Email", "BirthDate",
"Class.Name", "Class.GradeLevel", "CreatedAt"
);
var result = dbContext.Students
.Apply(request, allowed)
.ToList();
📋 Requirements
- .NET 8.0+
- Entity Framework Core 8.0+
❤️ License
MIT License
Created with ♥ by Muammar Siddiqui • Innovador Solutions
Happy querying! 🚀
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.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.