Basic Entity Framework Question
-
When you create an EF Data Context using DB first it creates data models for you. Those models are in the EDMX. I created the data in a project called DAL. Therefore the data context and the data models are all in that project. So then I add this project to a solution along side a WPF/MVVM project. To use the data models I then reference the DAL project, which gives me access to the data models. With EF is this the right way to do this? Directly reference the generated Data Models? Or do you somehow use your own data models? How do the generated Data Models handle INotifyPropertyChanged implementation in the WPF/MVVM project?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
When you create an EF Data Context using DB first it creates data models for you. Those models are in the EDMX. I created the data in a project called DAL. Therefore the data context and the data models are all in that project. So then I add this project to a solution along side a WPF/MVVM project. To use the data models I then reference the DAL project, which gives me access to the data models. With EF is this the right way to do this? Directly reference the generated Data Models? Or do you somehow use your own data models? How do the generated Data Models handle INotifyPropertyChanged implementation in the WPF/MVVM project?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
I use Viewmodels for implementing INotifyPropertyChanged and a Converter which copies members of datalayer EF Model Classes to Viewmodel Classes. Example for viewmodel base class: https://stackoverflow.com/questions/36149863/how-to-write-viewmodelbase-in-mvvm-wpf