Skip to content

Conversation

fiseni
Copy link
Collaborator

@fiseni fiseni commented Jun 12, 2025

It addresses issue #506

@fiseni fiseni requested a review from Copilot June 12, 2025 20:47
Copy link

@Copilot Copilot AI left a 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;

@fiseni fiseni merged commit 8513acf into main Jun 13, 2025
1 check passed
@fiseni fiseni deleted the fiseni/oneormany-where branch June 13, 2025 07:38
@fiseni fiseni linked an issue Jun 13, 2025 that may be closed by this pull request
This was referenced Aug 20, 2025
This was referenced Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use OneOrMany for all internal collections

1 participant