Mapster.Tool generates incorrect mapping extension method names when a destination type is nullable or generic
Example:
Declaration:
public class GenericTestSrc
{
public int Val { get; set; }
}
public class GenericTestDst<T>
{
public T Val { get; set; }
}
public record MyDateTime(DateTime? DateTime);
Mapper config:
config.ForType<MyDateTime, DateTime?>()
.MapWith(s => s.DateTime.Value )
.GenerateMapper(MapType.Map);
config.ForType<GenericTestSrc, GenericTestDst<int>>()
.GenerateMapper(MapType.Map);
What gets generated:
public static System.DateTime? AdaptToDateTime?(this MapLib.MapTest.MyDateTime s)
{
return (System.DateTime?)s.DateTime.Value;
}
public static MapLib.MapTest.GenericTestDst<int> AdaptToGenericTestDst<int>(this MapLib.MapTest.GenericTestSrc p1)
{
return p1 == null ? null : new MapLib.MapTest.GenericTestDst<int>() {Val = p1.Val};
}
Attached sample project:
MapsterBug.zip