-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
fix: Insert a cast to IDictionary
when an explicit setter is present
#341
Conversation
867e04e
to
0e8df3e
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #341 +/- ##
==========================================
+ Coverage 91.71% 92.03% +0.32%
==========================================
Files 109 122 +13
Lines 3379 3894 +515
Branches 438 531 +93
==========================================
+ Hits 3099 3584 +485
- Misses 189 209 +20
- Partials 91 101 +10
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Thanks for another great contribution!
The idea is to use a MappingBuilder to construct a Mapping object. The Mapping then should only transform the given information into a syntax. The MappingBuilder should provide all the required information for the Mapping to do only the transformation.
- This does not fix Enumerable / Dictionary mappings do not support explicit interface implementations #286 for enumerables, does it?
- This does not fix the case when the source implements
IDictionary<K, V>
,IReadOnlyDictionary<K, V>
orIEnumerable<KeyValuePair<K, V>>
explicitly, does it?
src/Riok.Mapperly/Descriptors/MappingBuilders/DictionaryMappingBuilder.cs
Outdated
Show resolved
Hide resolved
src/Riok.Mapperly/Descriptors/MappingBuilders/DictionaryMappingBuilder.cs
Outdated
Show resolved
Hide resolved
...ok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachSetDictionaryExistingTargetMapping.cs
Outdated
Show resolved
Hide resolved
...ok.Mapperly/Descriptors/Mappings/ExistingTarget/ForEachSetDictionaryExistingTargetMapping.cs
Show resolved
Hide resolved
Gotcha, I'll keep the invocation
Where is this a problem for Enumerables? Arrays aren't affected, I don't think the
Looking at the tests the only thing the source is used for is Enumerating. Do you have an example? |
Ah yap your totally right, foreach does work even if the |
A lot of .Net collections "implement" I created tldr I would be more inclined to delete |
Thank you for the input, this makes totally sense! However, I don't think removing |
Good point, #324 would prevent a lot of these cases. Unfortunately the casting problem would still affect |
6dc1609
to
897c928
Compare
src/Riok.Mapperly/Descriptors/MappingBuilders/DictionaryMappingBuilder.cs
Outdated
Show resolved
Hide resolved
src/Riok.Mapperly/Descriptors/MappingBuilders/DictionaryMappingBuilder.cs
Outdated
Show resolved
Hide resolved
82644c0
to
a27a0eb
Compare
I rebased the branch via GH and only then saw that there are two commits. Could you squash those two commits together into one feature commit? 😊 |
a27a0eb
to
ef22b20
Compare
Thanks for your many reviews 😄 I'll rebase and squish later |
8fe7228
to
38382ba
Compare
38382ba
to
41c45a0
Compare
@TimothyMakkison this looks ready to merge to me, are you okay with merging? |
Thanks for your help @latonz, you can merge this request! |
🎉 This PR is included in version 2.8.0-next.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Resolves #286
GetExplicitIndexer
should be inDictionaryMappingBuilder
orForEachSetDictionaryExistingTargetMapping