I am currently learning MVVM in WPF. I am creating an application that incorporates Entity Framework using Code First approach. What should be the proper structure of my project?
MVVM has this structure
Views
ViewModels
Model
My current plan is to put my POCO into the Model folder. Where should I put the class that inherits from the DbContext class?
MVVM does not specify a service infrastructure per se. While your POCO domain should remain in the “Model” directory the DbContext should not be known to the MVVM implementation.
In other words there shouldn’t be a class that derives from DbContext.
I normally provide that type of functionality through a ViewModelProvider construct that abstracts the “actual” model away from the ViewModel implementation. This lends to easier mocking etc. All concrete viewModel implementations should be “provided” through this abstraction.