I have one ViewModelfor handling enumerations (multiple objects in the Entity Framework).
ViewModel
1) It is philosophical whether it is good to use SINGLETON PATTERN for this ViewModel, because it is widespread throughout the application and is used in many places.
2) Isn't this a problem for the ViewModel (and its associated ObjectContext) for a very long time?
ObjectContext
Thank!
This should probably be broken down into two separate questions, but I will take a hit in both:
. , ViewModel Singleton. ( ), , . , , ... , .
ViewModels ( , ). MVVM ViewModel , .
Singleton ViewModel . , , SettingsViewModel. . , ViewModel . Singleton , , .
.
, . , , . . :
, , ViewModels, Singleton. , , . , ( ) / , .
Josh Smith ViewModelBase ViewModel INotifyPropertyChanged.
: http://mvvmfoundation.codeplex.com/
1) do not do this. see MVVM ViewModels Singleton 2) I don't think it is a good idea to have a viewmodel associated with an object context. It should be just a viewmodel, providing data for viewing; but not closely associated with any data technology. Instead, introduce services that take care of this, so you can mock them.