Open Closed

Where should I define my Custom Maps? #1250

eu11111 created

I would like to implement some Custom Maps. Where would be the perfect place to do so? In my application module?

3 Answer(s)
  • 0
    david created

    This is what i do in my web module, you can do the same in your Application module:

    public static class AutoMapperWebConfiguration { public static void Configure() { ConfigureAdministrationMapping();

        private static void ConfigureAdministrationMapping()
            var input = Mapper.CreateMap<ServerViewModel, ServerInput>();
            var AppUserToUserMap = Mapper.CreateMap<UserListDto, AppUserViewModel>()
                .ForMember(dest => dest.AppID,
                           opts => opts.MapFrom(src => src.UserName));

    and in initialize method of the module, i call AutoMapperWebConfiguration.Configure();

    It works for me, i don't know if there is a more elegant way of achieving it

  • 0
    hikalkan created
    Support Team

    We generally do it Initialize or PostInitialize method of our Application module.

  • 0
    eu11111 created

    Thanks for the reply guys!