I recently upgraded AutoMapper from 6.0.2 to 6.1.1 and got a problem:
public class Entity1
{
public Entity2 MyEntity2 { get; set; } // Entity2 is a class
public Guid MyEntity2Id { get;set; }
// Other parameters...
}
public class ViewModel1
{
Guid Entity1Id { get; set; }
// Other parameters...
}
The mapping:
cfg.CreateMap<Entity1, ViewModel1>.ReverseMap();
With version 6.0.2:
var myEntity1 = Mapper.Map<Entity1>(viewModel1);
after this mapping myEntity1.MyEntity2 is null.
After upgrading to v 6.1.1 I run exactly the same mapping but myEntity1.MyEntity2 is an empty Entity2 object and this creates a lot of problems.
Can anyone tell me how to change the mapping so myEntity1.MyEntity2 is null after the mapping?