Mapster
Mapster copied to clipboard
Why is the list collection mapping configuration invalid
TypeAdapterConfig.GlobalSettings.Default.IgnoreNullValues(true); var config = new TypeAdapterConfig(); config.ForType<a, b>().IgnoreNullValues(true); List lista=new List(); List listb=new List(); var test1= input[0].Adapt(entity[0], config); var test2= input.Adapt(entity, config);
The first is correct. Null is not mapped The list set mapping directly maps null into it
Does not support mapping collection types????
I think it's because CollectionAdapter is not performing null check before add to collection
private Expression CreateListSet(Expression source, Expression destination, CompileArgument arg)
{
//### IList<T>
//for (var i = 0, len = src.Count; i < len; i++) {
// var item = src[i];
// dest.Add(convert(item));
//}
//### IEnumerable<T>
//foreach (var item in src)
// dest.Add(convert(item));