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

Apply limit to IQueryable in FirstOrDefault/SingleOrDefaultMiddleware #6833

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

glen-84
Copy link
Collaborator

@glen-84 glen-84 commented Jan 17, 2024

Summary of the changes (Less than 80 chars)

  • Applied limit to IQueryables in FirstOrDefaultMiddleware and SingleOrDefaultMiddleware.
    • Take(1) for FirstOrDefault.
    • Take(2) for SingleOrDefault.

Closes #5566


Notes:

  • I'm not sure why the tests use AsExecutable, since it's more common to return an IQueryable.
    • I've removed this so that the IAsyncEnumerable path is followed, but let me know if it should be restored for some reason.
  • The application of the limit is slightly awkward – I'm assuming that non-IQueryable IAsyncEnumerables still need to be handled, otherwise the switch/case could be simplified.

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 76.42%. Comparing base (ad98734) to head (0feca76).

Files Patch % Lines
...src/Data/Projections/FirstOrDefaultMiddleware~1.cs 0.00% 6 Missing ⚠️
...rc/Data/Projections/SingleOrDefaultMiddleware~1.cs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6833      +/-   ##
==========================================
- Coverage   78.91%   76.42%   -2.49%     
==========================================
  Files        2605     2622      +17     
  Lines      130418   130981     +563     
==========================================
- Hits       102915   100108    -2807     
- Misses      27503    30873    +3370     
Flag Coverage Δ
unittests 76.42% <0.00%> (-2.49%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execute SingleOrDefault query on database
2 participants