MVVM deep dive

You can get a different instance each time by passing a different key to the GetInstance method. However the instances will be cached, so if you do not want to keep them in the cache, you will need to call Unregister with the corresponding key.

I was creating the VM upfront because the MainVM was sending messages to the SecondaryVM. Since the registration to the Messenger is done in the SecondaryVm's constructor, it needs to be created before it can start receiving messages. The Messenger is great because it is very decoupled, but it is one of these cases where you need to do extra work to compensate the decoupling: The SecondaryVM is the target of messages even though the MainVM does not get any reference to it.

Ref:

http://channel9.msdn.com/Events/MIX/MIX11/OPN03

http://*.com/questions/9342294/simpleioc-can-it-provide-new-instance-each-time-required/9350917#9350917

上一篇:深度学习 for java http://deeplearning4j.org/


下一篇:linux下的清屏命令