Is it possible to set some kind of global configuration that would cause mapping or validation process fail when some properties of mapped objects have same name, but have different types?
Source/destination types
public class UserData1
{
public int Id { get; set; }
}
public class UserData2
{
public string Id { get; set; }
}
Mapping configuration
Mapper.Initialize(cfg =>
{
cfg.CreateMap<UserData1, UserData2>();
});
Expected behavior
Either AssertConfigurationIsValid or Map should trigger some kind of validation exception when types of mapping properties are not same.
Actual behavior
int property is mapped to string without exception.
Steps to reproduce
// Passes OK
Mapper.Configuration.AssertConfigurationIsValid();
// Mapping is successful
var user2 = Mapper.Map<UserData2>(new UserData1 { Id = 156 });