When the destination of AutoMapper is an array and the input is a single object, errors can be thrown, particularity by mapping unit tests. There is a simple fix to allow the mapping to work as exptected:
.ForMember(dest => dest.PhoneNumbers, expression => expression.MapFrom(x => new[]{ x.PhoneNumber }))
No comments:
Post a Comment