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

SelectMany option for Specification<T, TResult> #294

Closed
Mattygs6 opened this issue Sep 22, 2022 · 7 comments
Closed

SelectMany option for Specification<T, TResult> #294

Mattygs6 opened this issue Sep 22, 2022 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Mattygs6
Copy link

It would be useful to be able to do a SelectMany and I believe it would not take much effort to add. I would be willing to make the adjustments if it would be considered.

@MisinformedDNA
Copy link
Contributor

I'm hitting a major performance issue. I'm currently querying an aggregate and its entities, but the DbContext is getting bloated and causing slow performance. My thought was to write two specs, one that queries the aggregate with AsNoTrackingWithIdentityResolution() and the other to query the entity, through the aggregate and the use of SelectMany(). I can't query the entity directly because my IRepository only works with aggregates.

I could ditch Specification for this scenario but having SelectMany() would make my life much easier.

@ardalis @fiseni ?

@fiseni
Copy link
Collaborator

fiseni commented Oct 19, 2022

Hi,

Yea, it would be great. Wanna give it a shot? @MGramolini ?

It's a bit of a problem though. Users might think that they can chain multiple SelectMany and Select statements, and that won't be the case. Yes, we're chaining various other methods, but we're just building the specification state. In the case of projections (the Select variants), the return type is a new type. But, the input to the next method will still be the entity in our case. So, it will be a bit confusing.

Also, if you used Select statement we shouldn't allow having SelectMany in the spec, and vice versa.

@ardalis ardalis added enhancement New feature or request help wanted Extra attention is needed labels Mar 9, 2023
@ardalis
Copy link
Owner

ardalis commented Mar 9, 2023

If someone wants to take on adding SelectMany support to the library, we're open to a pull request for it!

@amdavie
Copy link
Contributor

amdavie commented Mar 31, 2023

I also have a need for SelectMany. I haven't seen any traffic on this for a while, so I'm willing to attempt a PR if no one else has started work on this.

@stefannikolei
Copy link

Any plans for a release in the near future with thsi feature?

@fiseni
Copy link
Collaborator

fiseni commented May 2, 2023

Yes, in the next two weeks, around 15th May.

@fiseni
Copy link
Collaborator

fiseni commented Jul 21, 2023

Closing the issue, the feature is published in version 7.

@fiseni fiseni closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants