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]
As there is no answer to this, I'd like to add that nemesv's comment to the question pointed me in the right direction. That being the CreateMapper statements weren't executed, resulting in the same exception as OP's.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With