|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +QueryKit is a .NET library for parsing and applying filtering and sorting operations to IQueryable and IEnumerable collections. It provides a fluent, string-based syntax for complex queries that translates to efficient LINQ expressions. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +- **Core Library**: `/QueryKit/` - Main library with parsing and expression building logic |
| 12 | + - `FilterParser.cs` - Main parser for filter syntax (e.g., `Name == "John" && Age > 25`) |
| 13 | + - `SortParser.cs` - Parser for sort syntax (e.g., `Name asc, Age desc`) |
| 14 | + - `QueryKitExtensions.cs` - Extension methods (`ApplyQueryKitFilter`, `ApplyQueryKitSort`, `ApplyQueryKit`) |
| 15 | + - `QueryKitPropertyMappings.cs` - Configuration for property aliases and custom behaviors |
| 16 | + - `/Configuration/` - Configuration classes for customizing parsing behavior |
| 17 | + - `/Operators/` - Implementation of comparison operators (equals, contains, greater than, etc.) |
| 18 | + - `/Expressions/` - Expression tree building logic |
| 19 | + - `/Exceptions/` - Custom exception types for parsing errors |
| 20 | + |
| 21 | +- **Test Projects**: |
| 22 | + - `/QueryKit.UnitTests/` - Unit tests using xUnit |
| 23 | + - `/QueryKit.IntegrationTests/` - Integration tests with Entity Framework and PostgreSQL via Testcontainers |
| 24 | + - `/QueryKit.WebApiTestProject/` - Test web API for integration scenarios |
| 25 | + - `/SharedTestingHelper/` - Shared test utilities and data builders |
| 26 | + |
| 27 | +## Development Commands |
| 28 | + |
| 29 | +### Building |
| 30 | +```bash |
| 31 | +dotnet build |
| 32 | +dotnet build --configuration Release |
| 33 | +``` |
| 34 | + |
| 35 | +### Testing |
| 36 | +```bash |
| 37 | +# Run all tests |
| 38 | +dotnet test |
| 39 | + |
| 40 | +# Run specific test project |
| 41 | +dotnet test QueryKit.UnitTests/ |
| 42 | +dotnet test QueryKit.IntegrationTests/ |
| 43 | + |
| 44 | +# Run tests with coverage |
| 45 | +dotnet test --collect:"XPlat Code Coverage" |
| 46 | +``` |
| 47 | + |
| 48 | +### Packaging |
| 49 | +```bash |
| 50 | +# Pack NuGet package (already configured for multi-targeting: net6.0, net7.0, net8.0, net9.0) |
| 51 | +dotnet pack --configuration Release |
| 52 | +``` |
| 53 | + |
| 54 | +## Key Dependencies |
| 55 | + |
| 56 | +- **Sprache** (2.3.1) - Parser combinator library for building the filter/sort syntax parser |
| 57 | +- **Ardalis.SmartEnum** (8.2.0) - For type-safe enumerations in operators and configuration |
| 58 | + |
| 59 | +## Development Notes |
| 60 | + |
| 61 | +- The library supports multiple .NET versions (net6.0 through net9.0) |
| 62 | +- Integration tests use PostgreSQL via Testcontainers for realistic database scenarios |
| 63 | +- Filter syntax supports complex expressions with parentheses, logical operators (&&, ||), and extensive comparison operators |
| 64 | +- Property mappings allow aliasing entity properties to different query names |
| 65 | +- Custom operators and derived properties can be configured via QueryKitConfiguration |
| 66 | +- Error handling provides specific exception types for different parsing failures |
0 commit comments