Add named query filter support for .NET 10+#306
Merged
marcominerva merged 4 commits intomasterfrom Mar 12, 2026
Merged
Conversation
…atibility - Add ApplyQueryFilter overloads with filterName parameter (NET10_0_OR_GREATER) - Add XML documentation to all ModelBuilderExtensions methods - Create TinyHelpers.EntityFrameworkCore.Tests project with 12 unit tests - Verify ApplyQueryFilter works with both base classes and interfaces - Update README with interface usage and named query filter documentation Co-authored-by: marcominerva <3522534+marcominerva@users.noreply.github.com>
Refactored entity type filtering to use GetEntityTypes<TEntity> and IsAssignableTo for improved robustness. Updated query filter property access to use EF.Property<T> for better EF Core query translation support. These changes enhance maintainability and align with EF Core best practices.
There was a problem hiding this comment.
Pull request overview
This PR adds named query filter support (.NET 10+) to TinyHelpers.EntityFrameworkCore, refactors existing query filter methods to use GetEntityTypes<T>() and EF.Property<T>(), adds XML documentation, and introduces comprehensive test coverage.
Changes:
- Added
ApplyQueryFilteroverloads accepting afilterNameparameter (behind#if NET10_0_OR_GREATER) to support named query filters that can be selectively disabled at query time. - Refactored existing
ApplyQueryFilter<TEntity>to reuseGetEntityTypes<TEntity>()and switched property-based filters to useEF.Property<T>()instead ofExpression.Property, andIsAssignableToinstead ofIsAssignableFrom. - Added a new test project with unit tests covering all query filter variants, and updated the README with interface and named filter documentation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/TinyHelpers.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs |
Added named filter overloads, refactored existing methods, added XML docs |
tests/TinyHelpers.EntityFrameworkCore.Tests/Extensions/ModelBuilderExtensionsTests.cs |
New test class with 11 tests covering all filter scenarios |
tests/TinyHelpers.EntityFrameworkCore.Tests/TinyHelpers.EntityFrameworkCore.Tests.csproj |
New test project targeting net10.0 |
tests/TinyHelpers.EntityFrameworkCore.Tests/Usings.cs |
Global using for Xunit |
src/TinyHelpers.EntityFrameworkCore/README.md |
Documentation for interface-based and named query filters |
TinyHelpers.slnx |
Registered new test project in solution |
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant enhancements to the
TinyHelpers.EntityFrameworkCorelibrary, focusing on expanding query filter capabilities and adding comprehensive test coverage. The most important changes are grouped below by theme.Query Filter Enhancements
ModelBuilderExtensions.README.mdto demonstrate usage with interfaces and named query filters, including practical code examples.Testing Improvements
TinyHelpers.EntityFrameworkCore.Testswith extensive unit tests covering all query filter scenarios, including base class, interface, property name, and named filters. [1] [2]TinyHelpers.slnxfor better visibility and integration.Xunitin the test project to simplify test code.Closes #288