-
Notifications
You must be signed in to change notification settings - Fork 255
Refactor the state of where expressions as OneOrMany. #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the representation and evaluation of where expressions using the new OneOrMany state to address issue #506.
- Renames an existing test for clarity and adds a new test to cover multiple where expressions.
- Updates the WhereEvaluator and WhereValidator to use OneOrMany logic for filtering expressions.
- Refactors Specification.cs and OneOrMany.cs to align with the new data structure for storing where expressions.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/Ardalis.Specification.Tests/Evaluators/WhereEvaluatorTests.cs | Renamed one test and added a test for handling multiple where expressions. |
src/Ardalis.Specification/Validators/WhereValidator.cs | Updated filtering logic to utilize OneOrMany representation for where expressions. |
src/Ardalis.Specification/Specification.cs | Refactored _whereExpressions to use OneOrMany and updated related logic. |
src/Ardalis.Specification/Internals/OneOrMany.cs | Introduced DEFAULT_CAPACITY constant and updated list initialization. |
src/Ardalis.Specification/Evaluators/WhereEvaluator.cs | Adjusted both IQueryable and IEnumerable evaluation methods to incorporate OneOrMany. |
Comments suppressed due to low confidence (2)
src/Ardalis.Specification/Validators/WhereValidator.cs:12
- Consider adding a comment explaining the rationale for returning true immediately when OneOrManyWhereExpressions is empty and how further where expressions are handled.
if (spec.OneOrManyWhereExpressions.IsEmpty) return true;
src/Ardalis.Specification/Evaluators/WhereEvaluator.cs:33
- Include a comment clarifying why the query is returned immediately when OneOrManyWhereExpressions is empty and outlining the expected behavior in cases of multiple where expressions.
if (spec.OneOrManyWhereExpressions.IsEmpty) return query;
It addresses issue #506