Skip to content

Improve detection of collection element type #1720

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

bkoelman
Copy link
Member

With this PR, the collection element type for custom collection types that have no or multiple type parameters is now correctly detected.

JADNC v5.7.0 added internal assertions on the IQueryable<T> element type T to make it easier to track errors/bugs. It uses CollectionConverter.FindCollectionElementType to determine the element type, but that works only with types that have exactly one generic type parameter. MongoDB uses an internal type MongoQuery<TDocument, TOutput> : IQueryable<TOutput>, which causes assertion failures. This PR fixes that by properly walking up the interface hierarchy to infer that TOutput is the element type.

QUALITY CHECKLIST

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.78%. Comparing base (3ad189d) to head (f7949df).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1720   +/-   ##
=======================================
  Coverage   90.78%   90.78%           
=======================================
  Files         467      467           
  Lines       14611    14612    +1     
  Branches     2299     2302    +3     
=======================================
+ Hits        13264    13265    +1     
  Misses        917      917           
  Partials      430      430           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bkoelman bkoelman marked this pull request as ready for review April 24, 2025 23:10
@bkoelman bkoelman merged commit a0877ab into master Apr 24, 2025
16 checks passed
@bkoelman bkoelman deleted the improve-collection-detection branch April 24, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant