I am using MVVM pattern in WPF to create a program.
I was peacefully implementing INPC on my model classes .... until a few days ago when I decided to use EntityFramework. Now I dont know how I can tell the EntityFramework to implement INPC on the generated entity classes and raise the property changed event every time a property changes.
Other questions such as this simply suggest to implement INPC on ViewModel, but I really want the Model classes to implement INPC to reduce the amount of work.
I am using Model-first approach to generate my model.
The recent release of Microsoft Prism's "Unity Container" addresses this question straight on with its 'Behaviour Interception' feature. Using the feature can make any class BEHAVE as though it inherits from INotifyPropertyChanged.
The most compelling attraction to the feature is that your EF classes can remain blissfully unaware of what's happening and do not need manual coding modifications in order to work. As you might expect, there's a performance hit which you have to measure against your requirements.
You can download Prism here. Prism
There's a walk-through that you SHOULD be able to cut-and-paste into your code here. Interception Behaviour You can wire up the code from this walkthrough in your app's start up phase, and Unity will handle the rest...
Having some code all ready is a great advantage because it can get hairy if you haven't worked with Type Injection before, so I recommend the walkthrough.
You can do this with a few lines of code using a NuGet package called PropertyChanged.Fody. The documentation is on GitHub. See my CodeProject tip "Adding INotifyPropertyChanged to Entity Framework Classes".