Implement INotifyPropertyChanged on generated Entity Framework classes

前端 未结 5 1058
有刺的猬
有刺的猬 2020-11-30 11:11

I have an SQL DB and am implementing a WPF UI to update it. If I use EF5 to generate the classes from the DB, how can I implement INotifyPropertyChanged on the generated cla

5条回答
  •  Happy的楠姐
    2020-11-30 11:42

    You can edit the EF template (.tt file) to generate the propertyChanged stuff on your properties, or (a bit risky:)) to edit the generated classes. The last is a bit risky, because if you regenerate the model, all changes will be lost. So maybe the variant with the wrapper classes or the template editing (a bit hard :S) are the best.

提交回复
热议问题