Skip to content

Commit 8a49403

Browse files
Merge pull request #109 from thomasclaudiushuber/issue-106
Extend INotifyPropertyChanged in generated ViewModel interface
2 parents 0829e5b + 8644537 commit 8a49403

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/MvvmGen.SourceGenerators.Tests/ViewModelGeneratorTests/ViewModelGenerateFactoryAttributeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public EmployeeViewModel()
200200
partial void OnInitialize();
201201
}}
202202
203-
public interface IEmployeeViewModel
203+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
204204
{{
205205
}}
206206
@@ -250,7 +250,7 @@ public EmployeeViewModel()
250250
partial void OnInitialize();
251251
}}
252252
253-
public interface IEmployeeViewModel
253+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
254254
{{
255255
}}
256256

src/MvvmGen.SourceGenerators.Tests/ViewModelGeneratorTests/ViewModelGenerateInterfaceAttributeTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public string FirstName
6060
}}
6161
}}
6262
63-
public interface IEmployeeViewModel
63+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
6464
{{
6565
string FirstName {{ get; set; }}
6666
string LastName {{ get; set; }}
@@ -134,7 +134,7 @@ public bool IsDeveloper
134134
protected MyCode.Employee Model {{ get; set; }}
135135
}}
136136
137-
public interface IEmployeeViewModel
137+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
138138
{{
139139
string FirstName {{ get; set; }}
140140
bool IsDeveloper {{ get; set; }}
@@ -177,7 +177,7 @@ public EmployeeViewModel()
177177
public IDelegateCommand SaveCommand => _saveCommand ??= new DelegateCommand(_ => Save());
178178
}}
179179
180-
public interface IEmployeeViewModel
180+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
181181
{{
182182
IDelegateCommand SaveCommand {{ get; }}
183183
void Save();
@@ -214,7 +214,7 @@ public EmployeeViewModel()
214214
partial void OnInitialize();
215215
}}
216216
217-
public interface ICustomInterfaceName
217+
public interface ICustomInterfaceName : System.ComponentModel.INotifyPropertyChanged
218218
{{
219219
}}
220220
}}
@@ -251,7 +251,7 @@ public EmployeeViewModel()
251251
partial void OnInitialize();
252252
}}
253253
254-
public interface IEmployeeViewModel
254+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
255255
{{
256256
}}
257257
}}
@@ -289,7 +289,7 @@ public EmployeeViewModel()
289289
partial void OnInitialize();
290290
}}
291291
292-
public interface IEmployeeViewModel
292+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
293293
{{
294294
void MyMethod<T>(T item);
295295
}}
@@ -328,7 +328,7 @@ public EmployeeViewModel()
328328
partial void OnInitialize();
329329
}}
330330
331-
public interface IEmployeeViewModel
331+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
332332
{{
333333
void MyMethod<T>(T item) where T : new();
334334
}}
@@ -368,7 +368,7 @@ public EmployeeViewModel()
368368
partial void OnInitialize();
369369
}}
370370
371-
public interface IEmployeeViewModel
371+
public interface IEmployeeViewModel : System.ComponentModel.INotifyPropertyChanged
372372
{{
373373
void MyMethod<K, V>(K key, V value) where K : new() where V : class;
374374
}}

src/MvvmGen.SourceGenerators/Generators/ViewModelInterfaceGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal static void GenerateViewModelInterface(this ViewModelBuilder vmBuilder,
2222
var accessModifier = viewModelToGenerate.ClassAccessModifier;
2323

2424
vmBuilder.AppendLine();
25-
vmBuilder.AppendLine($"{accessModifier} interface {interfaceToGenerate.InterfaceName}");
25+
vmBuilder.AppendLine($"{accessModifier} interface {interfaceToGenerate.InterfaceName} : System.ComponentModel.INotifyPropertyChanged");
2626
vmBuilder.AppendLine("{");
2727
vmBuilder.IncreaseIndent();
2828

0 commit comments

Comments
 (0)