-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Feat: add recursive depth support to projection mappings #878
Conversation
Does this really resolve #849? |
Mb 😅, knew this had a load of related issues and saw "circular reference" in the title. I'll fix it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR, nice work!
Is there sth. which hinders us to implement this for all kind of mappings instead of just IQueryable projections? I think it should almost never apply to non-IQueryable mappings anyway (as the mappings are re-used). WDYT?
src/Riok.Mapperly/Descriptors/InlineExpressionMappingBuilderContext.cs
Outdated
Show resolved
Hide resolved
src/Riok.Mapperly/Descriptors/InlineExpressionMappingBuilderContext.cs
Outdated
Show resolved
Hide resolved
Don't think so, just didn't see a massive need to.
It could be used to enhance loop detection. The current implementation relies on the parent contexts type bing the same as the current mapped type, this fails to detect mapping like: |
@TimothyMakkison I think I was confused, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates.
I think extracting ImmutableDictionary<TypeMappingKey, int>
and the calls to it into a new struct/class (eg. MappingRecoursingDepthTracker
) with a simple public API would probably make sense to simplify the logic inside the InlineExpressionMappingBuilderContext
. WDYT?
Is MaxRecursiveDepth
the correct term? Wouldn't a noun fit better eg. MaxRecursionDepth
?
6d22b45
to
15ddc85
Compare
5931f45
to
3b903b9
Compare
d537577
to
b6c4d7e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #878 +/- ##
==========================================
- Coverage 91.28% 91.14% -0.14%
==========================================
Files 234 237 +3
Lines 8086 8252 +166
Branches 1011 1031 +20
==========================================
+ Hits 7381 7521 +140
- Misses 456 482 +26
Partials 249 249 ☔ View full report in Codecov by Sentry. |
b6c4d7e
to
978100f
Compare
4bb37a3
to
7b4ab2a
Compare
@TimothyMakkison what is the status on this one? Should I review again? |
Super sorry for abandoned this. Iirc this PR was nearish to completion
I'll try to finish it but I'm happy for someone else to complete it. edit: just realised I can make |
7b4ab2a
to
c7ccc75
Compare
Added max recursive depth support for projection mappings.
Description
Added attributes and properties for
MaxDepth
.InlineExpressionMappingBuilderContext
uses anImmutableDictionary<(ISymbol, ISymbol), int>
to track types mapped by its parents, returning default when the limit is reached. The loop is prevented from occuring by disablingFindMapping
for previously seen types.Undecided/ not done
MappingBuilderContext
for improved loop detection, perhaps this could be explored in a separate PR.WIP
Fixes #785, #820, #99
Checklist