【发布时间】:2021-10-13 06:56:30
【问题描述】:
我有以下地图。所有小数类型的数字都有 2 个小数位。
CreateMap<decimal, decimal>().ConvertUsing(x => decimal.Round(x, 2, MidpointRounding.AwayFromZero));
但有时,我需要更多的小数位,例如
CreateMap<T, R>.ForMember(x => x.Total, x => x.MapFrom(x => decimal.Round(x.Items.Sum(x => x.Price * x.Quantity), 3, MidpointRounding.AwayFromZero)))
是否可以覆盖某些“CreateMap”中的全局 CreateMap?谢谢
【问题讨论】:
标签: c# .net-core automapper