In this example, we demonstrated how to notify a view model about changes when editing is performed by an independent View Model. This is implemented using the Messenger class:
- MainViewModel is subscribed to messages of the EntityChanged<Contact> type:
[C#]Messenger.Default.Register<EntityChanged<Contact>>(this,OnRefresh);
- DialogViewModel sends a message width the Id of the modified entity.
[C#]Messenger.Default.Send(newEntityChanged<Contact>(Entity.Id));
Question Comments
Added By: Christian Weber 4 at: 7/13/2015 11:30:51 PM
I just downloaded the example. I get an exception (System.Data.Entity.Core.ProviderIncompatibleException) when I want to execute the program. The exception is thrown in EmployeeCollectionViewModel::Initialize(), Line 73 (EmployeeContext.Employees.Load();).
Version: 15.1.4.0 (Trial)
Added By: Ivan (DevExpress Support) at: 7/14/2015 3:38:05 AM Hi Christian,I have created a new ticket on your behalf regarding this issue - ProviderIncompatibleException occurs when running E5001. Let's continue our discussion there.
Added By: Sascha Kretz 1 at: 9/6/2016 6:54:01 AM Hello,is there an updated example for the Messenger usage in mvvm?
As E5001 does not work for me either.
Rgds,
Sascha Added By: Alexander Ch (DevExpress Support) at: 9/6/2016 11:27:14 AM
Hi Sascha,
Let's discuss this issue in a separate thread: T423955 - The E5001 example does not work.
Thanks,
Alex