Ignoring properties that are nullable in the source but not nullable in the target #3941
sinanakyazici
started this conversation in
NA
Replies: 1 comment
-
Hello guys, I think authors won't help me. I solved my problem like this way, I hope this can help you.
|
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.
-
Hello guys,
AutoMapper Version : 10.1.1
AutoMapper.Collection Version : 7.0.1
.net core 3.1
I try to ignore null properties on source, I read a lot of things but I stuck in a point.
I want to do this for all props. I use ForAllMembers and Condition.
My Code:
This doesn't work when target is not nullable, srcMember gets default value of target type, For Example,
source prop type int? , target prop type int, srcMember is not null, is 0.
source prop type DateTime?, target prop type DateTime. srcMember is not null, is 1/1/0001 12:00:00 AM
source prop type bool?, target prop type bool, srcMember is not null, is false.
How I can fix this problem ?
I'm not sure if this is a bug.
Beta Was this translation helpful? Give feedback.
All reactions