-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Generate static methods in nonstatic classes #681
Generate static methods in nonstatic classes #681
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #681 +/- ##
==========================================
+ Coverage 91.40% 91.48% +0.08%
==========================================
Files 214 214
Lines 7189 7212 +23
Branches 869 872 +3
==========================================
+ Hits 6571 6598 +27
+ Misses 411 408 -3
+ Partials 207 206 -1 ☔ View full report in Codecov by Sentry. |
02175cf
to
14c709a
Compare
Hi, @latonz, @TimothyMakkison, can I ask you for your opinion about this functionality? And if so, can I ask for feedback on implementation? Thank you, |
The goal is to support this code: public interface IMyInterface
{
static abstract CarDto ToDto(Car car);
}
[Mapper(GenerateStaticMethods = true)]
public partial class CarMapper : IMyInterface
{
public static partial CarDto ToDto(Car car);
} |
Sorry for my late feedback, I had the pleasure to enjoy some vacation days 🏝️
I will comment on the issue #673 with the concerns that I have for this feature. |
Thanks, I will take a look at the missing parts |
Yes, for sure :) |
14c709a
to
c089017
Compare
6909d3f
to
6b72263
Compare
Hi @latonz, |
6b72263
to
57008f3
Compare
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 added my feedback 😊
test/Riok.Mapperly.IntegrationTests/TestMapperWithStaticMethodsTest.cs
Outdated
Show resolved
Hide resolved
test/Riok.Mapperly.Tests/Mapping/InstantiableMapperWithStaticMethodsTest.cs
Outdated
Show resolved
Hide resolved
test/Riok.Mapperly.Tests/Mapping/InstantiableMapperWithStaticMethodsTest.cs
Outdated
Show resolved
Hide resolved
test/Riok.Mapperly.Tests/Mapping/InstantiableMapperWithStaticMethodsTest.cs
Show resolved
Hide resolved
8686122
to
227cf5b
Compare
Hi, thank you for the review! I processed all recommendations. I left changes as separate commits, so it's easier to navigate through changes. Please let me know for the final rebase/squash |
227cf5b
to
3e1433b
Compare
test/Riok.Mapperly.Tests/Mapping/InstantiableMapperWithStaticMethodsTest.cs
Show resolved
Hide resolved
f6d46cb
to
45db532
Compare
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, only a few comments left and this can get merged 👍
test/Riok.Mapperly.IntegrationTests/Mapper/TestMapperWithStaticMethods.cs
Outdated
Show resolved
Hide resolved
I just checked my earlier comment #681 (comment) and noticed that there is still a problem with object factories and external mappers. In pseudo-static mappers, instance object factories and external mappers are still beeing used without a diagnostic. These should be ignored and a diagnostic should be emitted. |
99dd4b5
to
2b6db69
Compare
I will take a look at the factories and external mappers |
I dropped one test which I would say did not test what it was saying so: 2b6db69 |
I added tests for external mappers and object factories |
src/Riok.Mapperly/Descriptors/ObjectFactories/ObjectFactoryBuilder.cs
Outdated
Show resolved
Hide resolved
...InstantiableMapperWithStaticMethodsTest.ShouldUseSimpleObjectFactory#CarMapper.g.verified.cs
Outdated
Show resolved
Hide resolved
...napshots/ReferenceHandlingTest.CustomHandlerWithObjectFactoryShouldWork#Mapper.g.verified.cs
Outdated
Show resolved
Hide resolved
a94254d
to
25059f3
Compare
...napshots/ReferenceHandlingTest.CustomHandlerWithObjectFactoryShouldWork#Mapper.g.verified.cs
Outdated
Show resolved
Hide resolved
25059f3
to
25d2e30
Compare
…ings&ExtractObjectFactories
d931e58
to
ff6fac9
Compare
🎉 This PR is included in version 3.3.0-next.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 3.3.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Generate static methods in nonstatic classes
Description
This PR adds the Mapper configuration option
GenerateStaticMethods
which is a switch that generates static methods inside a non-static class.Fixes #673
Checklist