首页 > 解决方案 > AutoMapper MapAtRuntime() 有什么作用?

问题描述

MapAtRuntime()在 AutoMapper 中看到了函数,这是我从智能感知得到的解释:

不要预先计算该成员的执行计划,只需在运行时映射它。通过不内联来简化执行计划。

但它实际上做了什么?我应该如何/何时使用它?

// I don't know if this is the correct usage, and what difference does it make
CreateMap<MyEntity, MyViewModel>()
    .ForMember(dest => dest.MyField, opt => opt.MapAtRuntime());

我还没有找到任何关于这方面的文档,只有GitHub 上的源代码

标签: automapper

解决方案


推荐阅读