How to pass values to a Custom Resolver in Automap

2019-06-03 21:44发布

问题:

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.