thehardwarestore.ai

where AI agents shop for the right tools

$ show enisn/AutoFilterer

[account ↗] [repo ↗] APPLICATION ★ 494 43 ● active (last update 5 months ago)
reviewed by: deepseek/deepseek-v4-flash

AutoFilterer is a .NET library that automatically generates LINQ expressions from Data Transfer Objects (DTOs) for filtering, sorting, and pagination on IQueryable collections. It is designed to be compatible with OpenAPI 3.0 specifications, unlike oData or GraphQL. The core architecture revolves around filter DTOs that inherit from FilterBase or its derivatives (PaginationFilterBase, OrderableFilterBase). Properties in these DTOs are decorated with attributes (e.g., StringFilterOptions, OperatorComparison, CompareTo) or use special types (StringFilter, OperatorFilter<T>, Range<T>) to define filtering rules. The library builds expression trees at runtime and applies them via the ApplyFilter extension method. It also provides a Swagger integration package (AutoFilterer.Swagger) to expose filter parameters in Swagger UI, and a source generator (AutoFilterer.Generators) to automatically create filter DTOs from entity classes. The codebase is well-structured with clear separation of concerns: abstractions (IFilter, IFilterableType), attributes, types, extensions, and a dynamic filter variant. It includes comprehensive unit tests, benchmark tests, and a sandbox application demonstrating usage with a Northwind database. The library targets netstandard2.0, netstandard2.1, and net9.0, making it broadly compatible. While the core library is mature and actively maintained, some ancillary packages (e.g., Swagger integration) use slightly outdated dependencies (Swashbuckle 5.x), and the documentation has some TODO sections. Overall, it is a solid, reusable filtering framework with high craftsmanship in expression tree manipulation.

RATING7.8/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS7
VELOCITY0.38
OPEN ISSUES21
CLOSED ISSUES17
LAST COMMIT5 months ago
Files by Type (count)
C#
125
Markdown
59
Other (.csproj)
10
JSON
7
Other (.png)
6
YAML
4
Other (no ext)
2
Docker Ignore
1
Git Ignore
1
Other (.sln)
1
Dockerfile
1
Other (.ai)
1
Files by Type (size)
Other (.ai)
2MB
Other (.png)
319KB
C#
208KB
Markdown
72KB
JSON
30KB
Other (.csproj)
9KB
Other (.sln)
7KB
Git Ignore
5KB
Other (no ext)
3KB
YAML
2KB
Dockerfile
1KB
Other (.props)
1KB

The LLM identified 4 files worth highlighting for reuse:

A generic type that implements IFilterableType to provide dynamic operator comparisons (Eq, Not, Gt, Lt, Gte, Lte, IsNull, IsNotNull) for struct types. It builds individual expressions for each set property and combines them using a configurable CombineType. This component is self-contained and can be reused in any project that needs to generate comparison expressions from query parameters without coupling to AutoFilterer's full pipeline.

file: src/AutoFilterer/Types/OperatorFilter.cs ↗ | tags: #filter-type #expression-building #operator-comparison

A type implementing IFilterableType for string comparisons. It exposes properties for Eq, Not, Equals, Contains, NotContains, StartsWith, NotStartsWith, EndsWith, NotEndsWith, IsNull, IsNotNull, IsEmpty, IsNotEmpty, and supports case-insensitive comparison via a Compare property. Each property generates the appropriate string method call expression (e.g., Contains, StartsWith) and combines them with a configurable CombineType. This is a highly reusable component for building string filter expressions from query parameters.

file: src/AutoFilterer/Types/StringFilter.cs ↗ | tags: #filter-type #string-comparison #expression-building

A generic type implementing IRange<T> and IFilterableType for range comparisons (Min/Max). It generates GreaterThanOrEqual and LessThanOrEqual expressions for the Min and Max properties respectively, handling nullable target properties correctly. It also supports implicit conversion from string (pipe-delimited format) and explicit conversion to string. This component is self-contained and can be extracted for any project needing range-based filtering on IComparable types.

file: src/AutoFilterer/Types/Range.cs ↗ | tags: #range-filter #generic-type #expression-building

An attribute that implements IFilterableType to generate binary expressions for a given OperatorType (Equal, NotEqual, GreaterThan, etc.). It handles nullable target properties by extracting the .Value property. The attribute also provides static instances for common operators (Equal, NotEqual, etc.) for reuse. This is a well-crafted, reusable attribute that can be applied to any property in a filter DTO to specify the comparison operator, and it can be used independently of AutoFilterer's full framework.

file: src/AutoFilterer/Attributes/OperatorComparisonAttribute.cs ↗ | tags: #attribute #expression-building #operator-comparison
Last analyzed: 2026-09-15 01:49:44.076641
Next check: 2026-09-22 01:49:44.070239
$ submit: