I use Automapper in many locations in the code in my solution. But I don't understand why in one project of this solution, I do this :
Mapper.CreateMap<MY_CLASS, MyClass>();
Mapper.AssertConfigurationIsValid();
var result = Mapper.Map<List<MY_CLASS>, List<MyClass>>(myListResult);
I get this exception on the Mapper.Map
line :
Missing type map configuration or unsupported mapping
In the configuration, I ignore all properties except one, the Id
field, same exception
I really don't understand why. Is there a way to know with more precision the problem ?
Update 1
failed MyTestMethod threw exception: AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
Mapping types: MY_CLASS -> MyClass MyProject.DataContexts.MY_CLASS -> MyProject.BusinessModels.MyClass
Destination path: List`1[0]
Mapper.CreateMap<MY_CLASS, MyClass>();
gets called before theMapper.Map
? And also make sure that you haveMapper.CreateMap<MyProject.DataContexts.MY_CLASS, MyProject.BusinessModels.MyClass>();
maybe you have more types with the same name in different namespaces... – nemesv