I\'m mapping a list to another list with Automapper, but it seems that my items are not copied.
Here is my code:
var roles = userRepo.GetRoles(null).
Avoid adding Collections in your mapper configuration. Make sure you add all the types(classes). I had errors when collections were not in the config, but that was because all types were not included. Bit misleading but that's where the problem lies. Point is, remove all collections from mapper config and add all classes only. Add collections when doing the actual transformation ie. call to mapper.Map.
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap();
cfg.CreateMap().ReverseMap();
});
var mapper = config.CreateMapper();
var domainPetOwners = mapper.Map>(repoPetOwners);