We updated AutoMapper to version 11. After the upgrade we faced the problem that the AutoMapper sets a property to null if it does not exist in the source class. The behavior was only recognized in lists.
var mapper = new AutoMapper.Mapper(mapperConfig);
var destination = new Destination();
destination.Group = new Group();
destination.Definitions = new List<Definition>();
destination.Definitions.Add(new Definition() { Group = new Group() });
var source = new Source();
source.Definitions = new List<BusinessDefinition>();
source.Definitions.Add(new BusinessDefinition());
mapper.Map(source, destination);
var x = destination.Definitions[0].Group; // The property does not exist on the BusinessDefinition class. After mapping the "Group" property is null, i expect that the property keeps its value.
var z = destination.Group; // This property does not exist in the "Source" class. After mapping the value did not change in this case.
Hello
We updated AutoMapper to version 11. After the upgrade we faced the problem that the AutoMapper sets a property to null if it does not exist in the source class. The behavior was only recognized in lists.
`
`
ConsoleApp7.zip