We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69ef258 commit 7e30752Copy full SHA for 7e30752
src/Generators/Foundation/Codelisk.Foundation.Generator/Generators/ExtensionsGenerator.cs
@@ -73,6 +73,7 @@ IEnumerable<RecordDeclarationSyntax> baseDtos
73
.AddParameter("this " + dtoName, dtoName.GetParameterName())
74
.WithBody(x =>
75
{
76
+ x.If($"if({dtoName.GetParameterName()} is null) return null");
77
x.AppendLine(
78
$"var result = new {entityName}({dtoName.GetParameterName()});"
79
);
@@ -102,6 +103,7 @@ IEnumerable<RecordDeclarationSyntax> baseDtos
102
103
.AddParameter("this " + entityName, "entity")
104
105
106
+ x.If($"if(entity is null) return null");
107
x.AppendLine($"return entity as {dtoName};");
108
})
109
.WithReturnType(dtoName);
0 commit comments