We have an huge data driven application that involves multiple systems therefore a lot of mapping is needed. Due to performance issues we are gonna migrate from AutoMapper to Mapster.
Everything's good so far with Mapster but when mapping the Collections
Mapster returns null
value instead of empty Collection
.
Automapper used to return Empty Collections by default but I am unable to figure out how to do that in Mapster.
I have tried doing the following but it does not work
TypeAdapterConfig.GlobalSettings.ForDestinationType<ICollection>().IgnoreNullValues(true);
TypeAdapterConfig.GlobalSettings.ForType(typeof(ICollection), typeof(ObservableCollection<>))
.IgnoreNullValues(true);
TypeAdapterConfig.GlobalSettings.ForType(typeof(ObservableCollection<>), typeof(ICollection))
.IgnoreNullValues(true);
Any help would be great