This commit is contained in:
honzapatCZ 2026-04-12 14:01:45 +02:00
commit 099ce1dbd9

View File

@ -649,8 +649,6 @@ namespace AutoMapProperty
public static string? GeneratePropertyTo(List<ClassToGenerate> otherClasses, string Key, ITypeSymbol FromType, ITypeSymbol ToType, bool nullable = true)
{
var sb = new StringBuilder();
sb.Append(Key).Append(@" =");
var concreteToType = GetConcreteType(ToType);
@ -661,6 +659,15 @@ namespace AutoMapProperty
if (concreteFromType.IsAbstract)
return null;
var sb = new StringBuilder();
if (isArray)
{
sb.Append(Key).Append(".Any(); source.");
}
sb.Append(Key).Append(@" =");
if (isArray)
{
sb.Append("(").Append(FromType).Append(@")(this.").Append(Key).Append(" != null ? ");