eol to not have to setup certain parametres with null
This commit is contained in:
parent
501291c548
commit
0be24c0990
|
|
@ -279,12 +279,12 @@ namespace AutoMapProperty
|
||||||
IMethodSymbol? customFromMethod = null;
|
IMethodSymbol? customFromMethod = null;
|
||||||
bool customTo = false;
|
bool customTo = false;
|
||||||
IMethodSymbol? customToMethod = null;
|
IMethodSymbol? customToMethod = null;
|
||||||
if (attr.ConstructorArguments.Count() >= 3)
|
if (attr.ConstructorArguments.Count() >= 3 && attr.ConstructorArguments[2].Value is not null)
|
||||||
{
|
{
|
||||||
customTo = true;
|
customTo = true;
|
||||||
customToMethod = ProcessCustomAttribute(context, classSymbol, attr.ConstructorArguments[2]);
|
customToMethod = ProcessCustomAttribute(context, classSymbol, attr.ConstructorArguments[2]);
|
||||||
}
|
}
|
||||||
if (attr.ConstructorArguments.Count() >= 4)
|
if (attr.ConstructorArguments.Count() >= 4 && attr.ConstructorArguments[3].Value is not null)
|
||||||
{
|
{
|
||||||
customFrom = true;
|
customFrom = true;
|
||||||
customFromMethod = ProcessCustomAttribute(context, classSymbol, attr.ConstructorArguments[3]);
|
customFromMethod = ProcessCustomAttribute(context, classSymbol, attr.ConstructorArguments[3]);
|
||||||
|
|
@ -599,7 +599,7 @@ namespace AutoMapProperty
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append(Key).Append(" = (").Append(GetFullString(Value.ToType)).Append(@")").Append(GetFullMethodName(Value.CustomFromMethod)).Append(@"(providers, source, source").Append(prefix).Append(".").Append(Key).Append(")");
|
sb.Append(Key).Append(" = (").Append(GetFullString(Value.ToType)).Append(@")").Append(GetFullMethodName(Value.CustomFromMethod)).Append(@"(providers, source").Append(prefix).Append(", source").Append(prefix).Append(".").Append(Key).Append(")");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user