如何将值传递给自定义解析在Automapper? [英] How to pass values to a Custom Resolver in Automapper?

查看:243
本文介绍了如何将值传递给自定义解析在Automapper?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将值传递给我的自定义解析。该值的变化,所以我不能硬$ C C $他们在我的注册静态类。我怎样才能做到这一点?

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))); 

}

推荐答案

我问了一下这个在另一块电路板,被告知这是不可能做到在这个版本。

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

这篇关于如何将值传递给自定义解析在Automapper?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆