How to pass values to a Custom Resolver in Automapper?

十年热恋 提交于 2019-12-08 04:55:01

问题


I need to pass values to my Custom Resolver. The values change, so I can't hard code them in my register static class. How can I achieve this?

// Called from global.asa page
   public static void Register()
    {
        Mapper.CreateMap<Task, TaskTableViewModel>().ForMember(dest => dest.DueDate,
                                                               opt => opt.ResolveUsing<DueDateResolver>().ConstructedBy(() => new DueDateResolver(dateFormatString))); 

}


回答1:


I asked about this on another board and was told it isn't possible to do in this version.



来源:https://stackoverflow.com/questions/4925044/how-to-pass-values-to-a-custom-resolver-in-automapper

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!