This project has moved and is read-only. For the latest updates, please go here.


ViewModelBase's unnecessary dependence on specific Messenger


not everyone needs your stock Messenger coupled with ViewModelBase. someone not need Messenger at all. someone (like me) needs custom-implemented IMessenger. ViewModelBase needs to be completely decoupled of specific IMessenger implementation. without this, source code of ViewModelBase can not be used separately from your specific Messenger (i use this project in form of source files).

consider one easy correction in ViewModelBase.cs:

public virtual void Cleanup() { Messenger.Default.Unregister(this); }


public virtual void Cleanup() { MessengerInstance.Unregister(this); }

another needed correction is to demand IMessenger instance in constructor (remove empty one) or allow null-valued one and throw exceptions when referenced. in any case do not use specific Messenger.Default. i understand that this is breaking change and may have side-effects, but this is important architectural decision
Closed Oct 13, 2014 at 1:54 PM by lbugnion