0

We have been using AutoMapper since some time now. We were trying to update the AutoMapper version and some things started to fail.

Wherever Lists were defined with Private Setter the mapper silently fails and the List turns out Empty.

I tried looking into the issue and found some answers where adding a UseDestinationValue function would solve the issue.

I looked at Automapper nested Collections without setter

and

https://github.com/AutoMapper/AutoMapper/issues/2126

The issue is that our project is a big to find all those issues and fix them. Is there any means by which we can do this globally?

pratikvasa
  • 1,897
  • 20
  • 24
  • Without any additional config, AutoMapper skips properties without a setter. so you have to explicitly define it like : .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.Children)) – MustafaOmar Jul 09 '20 at 06:09
  • https://docs.automapper.org/en/latest/10.0-Upgrade-Guide.html#all-collections-are-mapped-by-default-even-if-they-have-no-setter – Lucian Bargaoanu Jul 09 '20 at 06:16

0 Answers0