Replies: 1 comment
-
|
Hi @wbsnipes, this is very strange.🤔 Please answer the following questions so we can pinpoint the problem more accurately:
Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
We've been adopting Mapster gradually for a year or so and find it most excellent! Thank you!
I did have one question or perhaps issue to raise on dependency injection when changing GlobalSettings. It may just be one setting that is an issue. We've tried injecting Mapster (v7.4.0) two ways. Only one of those ways seems to enact the setting for MapToConstructor(true) as default, this way works:
TypeAdapterConfig.GlobalSettings.Default.MapToConstructor(true);The non-working way does enact the other two settings, but the MapToConstructor(true) one seems to not take effect as shown here:
The MapToConstructor extension implementation looks like the other ones, so my question is why did it not enact? There are nuances (perhaps a setter with other actions included) in our code that manifest an issue at runtime when MapToConstructor(true) is not enacted.
So, of the two following ways the first one seems to be frequently cited, however, the second one is the one that works for us. Any recommendations or pitfalls of the working DI method? Any thoughts on why it might be different?
Gory details:
The DI method for the way that does not work looks like this where the Default settings are added to the config variable by the ConfigureMapsterMappings() method shown above :
The working DI method is this one:
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions