How would one go about handling a situation like this? Having more than one ViewModel having a reference to the same POCO object. ViewModel A updates the POCO… now ViewModel B needs to know about this somehow?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that your POCO can’t implement
INotifyPropertyChanged, you could use a mediator pattern to alert other view models when a POCO is changed:Your view model can then implement the
ICareWhenAModelChanges<T>interface, register itself with a shared instance of the mediator (acquired through either a singleton or, better, some kind of DI/IoC framework) and do whatever it needs to in theModelUpdatedmethod