-
Notifications
You must be signed in to change notification settings - Fork 341
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
When using TypeAdapterConfig.GlobalSettings.Default.IgnoreNullValues(true), it causes the Mapper function to be called twice. #737
Comments
The attachment did not upload successfully, I am re-uploading it here. |
Hello @jiuzhou2019 This cannot be avoided. Without caching the function result. (But there will still be two calls. Only second call the result will be obtained from the cache)
Where getter of Property src.Summary == call of func SummaryDetail(src.Summary) as per your setting. |
@jiuzhou2019 @stagep @andrerav upd: Behavior matches design
|
@jiuzhou2019 @stagep @andrerav Or was the problem meant to be that the function call is incorrectly defined as allowing a Null return value? I didn't quite figure out what exactly is being checked there ))
behavior now
behavior after
|
There is example code following this. When Adapt() is called, it can be seen from the console that SummaryDetail runs twice. I would like to ask what is the reason for this and how to avoid it. I have also uploaded the test code for the entire project in the attachment. Thank you all for helping me answer this.
Please attach the test code file, and I will take a look to provide further assistance.
TestMapster.zip
Program.cs:
TestInput.cs:
MapperConfig.cs
Controller.cs
The text was updated successfully, but these errors were encountered: