How do I get AutoMapper to not cache mapped objects?

前端 未结 5 1754
不思量自难忘°
不思量自难忘° 2021-02-04 00:37

When AutoMapper encounters an object that\'s already been mapped, it seems to use that object again, instead of trying to re-map it. I believe it does this based on .Equal

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 00:55

    I've faced the same issue with the mapper, looking around i found that a solution for it, by adding

    Mapper.Reset();
    

    Source blog (corrected URL)

提交回复
热议问题