Skip to content
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

Implement SelectMany support #320

Merged
merged 3 commits into from
Apr 8, 2023
Merged

Conversation

amdavie
Copy link
Contributor

@amdavie amdavie commented Mar 31, 2023

For issue #294

Usage:

public class StoreProductNamesSpec : Specification<Store, string?>
{
  public StoreProductNamesSpec()
  {
    Query.SelectMany(s => s.Products.Select(p => p.Name));
  }
}

Concurrent usage of Select and SelectMany is prevented via a runtime evaluator exception.

We may want to rename ISpecification<T, TResult>.Selector to SelectExpression to match the newly added SelectManyExpression to be consistent (I couldn't come up with a good name other than SelectManyExpression).

Let me know how it looks - happy to make additional changes.

@fiseni
Copy link
Collaborator

fiseni commented Apr 6, 2023

Hey @amdavie

Thank you for your work.
I don't like the Selector name either, but we've defined that since the beginning, and would be a breaking change to rename it. Therefore, let's name the other one SelectorMany perhaps? Just to be consistent.

@amdavie
Copy link
Contributor Author

amdavie commented Apr 7, 2023

@fiseni no problem. SelectorMany it is.

@fiseni fiseni merged commit 39e082b into ardalis:main Apr 8, 2023
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.

2 participants