fixup abstract to generation
This commit is contained in:
parent
ead01089be
commit
90da30344e
|
|
@ -604,7 +604,7 @@ namespace AutoMapProperty
|
|||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
public static string GeneratePropertyTo(List<ClassToGenerate> otherClasses, string Key, ITypeSymbol FromType, ITypeSymbol ToType, bool nullable = true)
|
||||
public static string? GeneratePropertyTo(List<ClassToGenerate> otherClasses, string Key, ITypeSymbol FromType, ITypeSymbol ToType, bool nullable = true)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(Key).Append(@" =");
|
||||
|
|
@ -615,6 +615,9 @@ namespace AutoMapProperty
|
|||
|
||||
bool isArray = !SymbolEqualityComparer.Default.Equals(FromType, concreteFromType);
|
||||
|
||||
if (concreteFromType.IsAbstract)
|
||||
return null;
|
||||
|
||||
if (isArray)
|
||||
{
|
||||
sb.Append("(").Append(FromType).Append(@")(this.").Append(Key).Append(" != null ? ");
|
||||
|
|
@ -657,7 +660,10 @@ namespace AutoMapProperty
|
|||
{
|
||||
if (Value.FromIsReadOnly)
|
||||
return null;
|
||||
retSb.Append(GeneratePropertyTo(otherClasses, Key, Value.FromType, Value.ToType, nullable));
|
||||
var generated = GeneratePropertyTo(otherClasses, Key, Value.FromType, Value.ToType, nullable);
|
||||
if (generated == null)
|
||||
return null;
|
||||
retSb.Append(generated);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -916,7 +922,9 @@ namespace ").Append(classToGenerate.Namespace).Append(@"
|
|||
return null;
|
||||
{");
|
||||
foreach (var prop in classToGenerate.MappableProperties)
|
||||
{
|
||||
{/*
|
||||
if (prop.Value.FromType.IsAbstract)
|
||||
continue;*/
|
||||
var property = GenerateCorrectToProperty(otherClasses, prop.Key, prop.Value);
|
||||
if (property == null)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user