I'm using auto mapper to map two objects, but when I call
Mapper.Map<PropertyDto>(CreatePropertyRequestDto, property)
an exception is thrown saying
Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters ==================================================================================================================================== AutoMapper created this type map for you, but your types cannot be mapped using the current configuration. CreatePropertyRequestDto -> PropertyDto (Destination member list) PropertyHippo.Properties.Shared.HttpRequestResponse.Dto.CreatePropertyRequestDto -> PropertyHippo.Properties.Shared.Dto.PropertyDto (Destination member list)
Unmapped properties: PropertyId Guid CreateDate UpdateDate LastEditedBy GuidString
Below is my configuration.
CreateMap<CreatePropertyRequestDto, PropertyDto>()
.ForMember(dest => dest.PropertyId, opt => opt.Ignore())
.ForMember(dest => dest.Guid, opt => opt.Ignore())
.ForMember(dest => dest.CreateDate, opt => opt.Ignore())
.ForMember(dest => dest.UpdateDate, opt => opt.Ignore())
.ForMember(dest => dest.LastEditedBy, opt => opt.Ignore())
.ForMember(dest => dest.GuidString, opt => opt.Ignore());
I have searched for the answer and found this and this and in the docs but I still can't see what I'm doing wrong.
What am I missing?
EDIT
Added the breakpoint and can see that block of code is being hit. As a test I also removed the offending properties and can see the mapping works as expected