首页 新闻 赞助 找找看

.NET Core 项目升级 AutoMapper 后遇到的 lambda 表达式问题

0
悬赏园豆:30 [已解决问题] 解决于 2018-12-11 16:23

将 AutoMapper 由 7.0 升级至 8.0 后,下面的代码

cfg.CreateMap<JobOffer, Document>().ConstructUsing(j =>
{
    //...
});

Build 时报错

A lambda expression with a statement body cannot be converted to an expression tree

请问如何解决?

dudu的主页 dudu | 高人七级 | 园豆:31075
提问于:2018-12-11 16:08
< >
分享
最佳答案
0

改为下面的代码解决了

cfg.CreateMap<JobOffer, Document>().ConstructUsing((j, context) =>
{
    //...
});
dudu | 高人七级 |园豆:31075 | 2018-12-11 16:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册