AutoMapper: Ignoring Nested Property in Mapping Configuration Results in Null Value
I'm encountering an issue with AutoMapper where I'm trying to ignore a nested property during mapping, but it's still being set to null in the destination object. Here's my setup:
I have two classes, CompanyUpdateRequest and ApiUpdateRequest, where ApiUpdateRequestcontains a nested property ApiKey:
However, when I map from CompanyUpdateRequest to Company, the ApiKey property within the Api objects ends up being null, even though it's not present in the source object (ApiUpdateRequest).
I'm puzzled as to why this is happening. Is there a limitation in AutoMapper that prevents ignoring properties within nested entities, or am I missing something in my configuration?
4 Replies
i recall there should be no issues with nested objects
do you have any configuration specifying MemberList.Source/Destination?
also, what this field should result to?
have you tried reducing this to a minimal controlled sample?
I don't have other configurations, nested objects works in other situations.
I suspect that since my request is not taking any value for apikey it reevaluates it as null even when im trying to ignore it?
well what should it be?
It should ignore