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://stackoverflow.com/questions/9342294/simpleioc-can-it-provide-new-instance-each-time-required/9350917#9350917

MVVM deep dive的更多相关文章

  1. Deep Dive into Spark SQL’s Catalyst Optimizer(中英双语)

    文章标题 Deep Dive into Spark SQL’s Catalyst Optimizer 作者介绍 Michael Armbrust, Yin Huai, Cheng Liang, Rey ...

  2. X64 Deep Dive

    zhuan http://www.codemachine.com/article_x64deepdive.html X64 Deep Dive This tutorial discusses some ...

  3. 《Docker Deep Dive》Note - Docker 引擎

    <Docker Deep Dive>Note Docker 引擎 1. 概览 graph TB A(Docker client) --- B(daemon) subgraph Docker ...

  4. 《Docker Deep Dive》Note - 纵观 Docker

    <Docker Deep Dive>Note 由于GFW的隔离,国内拉取镜像会报TLS handshake timeout的错误:需要配置 registry-mirrors 为国内源解决这 ...

  5. Deep Dive into Neo4j 3.5 Full Text Search

    In this blog we will go over the Full Text Search capabilities available in the latest major release ...

  6. 重磅解读:K8s Cluster Autoscaler模块及对应华为云插件Deep Dive

    摘要:本文将解密K8s Cluster Autoscaler模块的架构和代码的Deep Dive,及K8s Cluster Autoscaler 华为云插件. 背景信息 基于业务团队(Cloud BU ...

  7. vue3 deep dive

    vue3 deep dive vue core vnode vue core render / mount / patch refs https://www.vuemastery.com/course ...

  8. A Deep Dive Into Draggable and DragTarget in Flutter

    https://medium.com/flutter-community/a-deep-dive-into-draggable-and-dragtarget-in-flutter-487919f6f1 ...

  9. SQL optimizer -Query Optimizer Deep Dive

    refer: http://sqlblog.com/blogs/paul_white/archive/2012/04/28/query-optimizer-deep-dive-part-1.aspx  ...

随机推荐

  1. ASP.NET 4.0 取消表单危险字符验证

    /// <summary> /// ASP.NET4.0 表单验证类 /// </summary> public class FormRequestValidation : R ...

  2. 如何解决""No boot device available(无可用的引导设备)”错误

    首先换一个镜像文件试一试,如果还不行就按以下方法尝试 http://www.parallelsdesktop.cn/xnjxt-wydsb.html Parallels Desktop 常见问题 ht ...

  3. 分布式文件系统FastDFS设计原理(转)

    FastDFS是一个开源的轻量级分布式文件系统,由跟踪服务器(tracker server).存储服务器(storage server)和客户端(client)三个部分组成,主要解决了海量数据存储问题 ...

  4. Liferay 6.2 改造系列之六:修改系统初始化信息

    将初始化过程修改为:中文语言 在/portal-master/portal-impl/src/system.properties文件中,有如下配置: # # Set the default local ...

  5. js正则表达式练习

    匹配完整的名字 function process_name() { var field = document.getElementById("name_field"); var n ...

  6. Zepto tap 穿透bug

    当两个层重叠在一起时,使用Zepto的tap事件时,点击上面的一层时会触发下面一层的事件,特别是底层如果是input框时,必“穿透”,“google”说原因是“tap事件实际上是在冒泡到body上时才 ...

  7. wpf 触发器,属性触发器,事件触发器,事件触发器。

    <EventTrigger RoutedEvent="Mouse.MouseEnter"/> <DataTrigger Binding="{Bindin ...

  8. NSDICTIONARY获取内容的CRASH

    NSString *path = [self.dataPath stringByAppendingPathComponent:@"dummy.plist"]; NSMutableD ...

  9. Linux profile File

    umask 022alias vim="/pd/vim/7.1/bin/vim"if [ -e /usr/bin/vim ]; then alias vim="/usr/ ...

  10. 餐厅点餐系统app第二天

    队友: 郭志豪:http://www.cnblogs.com/gzh13692021053/ 杨子健:http://www.cnblogs.com/yzj666/ 刘森松:http://www.cnb ...