Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automapper, mapping exception

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]

like image 561
Kris-I Avatar asked Sep 20 '25 17:09

Kris-I


1 Answers

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.

like image 97
Sylvain Girard Avatar answered Sep 22 '25 09:09

Sylvain Girard