Base solution for your next web application
Open Closed

Auto mapper issue in every entity Edit view after V7.1 update. #7402


User avatar
1
Mazharmig created

Hi, Automapper is giving error in every entity edit view. Automapper is updated to 4.8.1 in V7.1 update. Why the update process is not smooth? Need urgent Response


7 Answer(s)
  • User Avatar
    0
    Mazharmig created

    Please check if this can be single step solution or I have to add ReverseMap() in every map in custom mapper. What about Rad Tool? It should also add ReverseMap in custom mapper.

  • User Avatar
    1
    michael.pear created

    I am seeing this problem using the Rad Power Tools 2.0.2.1 with a new V7.1.0 AspNetZero project. I can enter new entity through the generated interface with no problem, but an Automapper exception is thrown when attempting to edit the entity. The problem appears to be with the generated "CreateOrEdit" Dto. Here is exception (without full stacktrace) showing in log:

    ERROR 2019-07-26 11:55:26,310 [121  ] Mvc.ExceptionHandling.AbpExceptionFilter - Missing type map configuration or unsupported mapping.
    
    Mapping types:
    Trainee -> CreateOrEditTraineeDto
    NexusApps.TrainingManager.Trainee -> NexusApps.TrainingManager.Dtos.CreateOrEditTraineeDto
    AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
    
    Mapping types:
    Trainee -> CreateOrEditTraineeDto
    NexusApps.TrainingManager.Trainee -> NexusApps.TrainingManager.Dtos.CreateOrEditTraineeDto
    
  • User Avatar
    0
    michael.pear created

    Confirmed that the order of the mapping in the "CreateMap" method written in CustomDtoMapper.cs by the Rad Power Tools has the Dto and Entity reversed, so either the order of the mapping needs to be changed to CreateMap<Entity,Dto> or add ".ReverseMap()". Hoping this can be fixed in the Power Tools quickly

  • User Avatar
    0
    Mazharmig created

    Any update?

  • User Avatar
    0
    maliming created
    Support Team

    @Mazharmig

    Automapper 8.1.1 version modifies CreateMissingTypeMaps, default is false.

    AutoMapper no longer creates maps automatically (CreateMissingTypeMaps and conventions) You will need to explicitly configure maps, manually or using reflection. Also consider attribute mapping. https://docs.automapper.org/en/latest/Attribute-mapping.html

    see: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4724#issuecomment-515679300

  • User Avatar
    0
    Mazharmig created

    I am using ReverseMap() right now and its working fine. I am waiting for RAD Tool update now. Can u please update Rad Tool so that it can append ReverseMap() in CustomDtoMapper. Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team