Skip to content

Commit 026b5fc

Browse files
committed
Generated code cleanup
1 parent bf2be51 commit 026b5fc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

SimpleViewModel/SimpleViewModel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1111
<PackageId>SimpleViewModel</PackageId>
12-
<Version>0.9.6.1</Version>
12+
<Version>0.9.6.2</Version>
1313
<Authors>Derek Gooding</Authors>
1414
<Company>Derek Gooding</Company>
1515
<Description>

ViewModelGenerator/ViewModelGenerator.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ public partial class {className} : BaseViewModel
7171
var fieldName = ToPascal(field.Name);
7272

7373
viewModelBuilder.AppendLine(
74-
$@" public {fieldType} {fieldName} {{ get => {field.Name}; set
74+
$@" public {fieldType} {fieldName} {{ get => {field.Name};
75+
set
7576
{{
7677
SetProperty(ref {field.Name}, value);");
7778

7879
var onChange = GetOnChangeMethodName(field);
7980
if (!string.IsNullOrWhiteSpace(onChange))
8081
viewModelBuilder.AppendLine($" {onChange}();");
8182
viewModelBuilder.AppendLine(" }");
83+
viewModelBuilder.AppendLine(" }");
8284
}
8385

8486
foreach (var method in commandMethods)
@@ -112,9 +114,9 @@ public override void Execute(object? parameter)
112114
");
113115
var canExecute = GetCanExecuteMethodName(method);
114116
if(!string.IsNullOrWhiteSpace(canExecute))
115-
viewModelBuilder.AppendLine($" public override bool CanExecute(object? parameter) => vm.{canExecute}();");
116-
viewModelBuilder.AppendLine(" }");
117-
viewModelBuilder.AppendLine("}");
117+
commandBuilder.AppendLine($" public override bool CanExecute(object? parameter) => vm.{canExecute}();");
118+
commandBuilder.AppendLine(" }");
119+
commandBuilder.AppendLine("}");
118120
spc.AddSource($"{commandClassName}.g.cs", SourceText.From(commandBuilder.ToString(), Encoding.UTF8));
119121
}
120122

0 commit comments

Comments
 (0)