Adding an instance to a MEF container
How can you add an already created instance to a MEF container/cataloge to use when resolving Imports. I want the functionality that Unity gives with the RegisterInstance method on its containers.
You can use the ComposeExportedValue function for this, like so:
var container = new CompositionContainer();
container..ComposeExportedValue<IConfigFileInvoker>(new ConfigFileInvoker()); container..ComposeExportedValue<IConfigFileInvoker>("export-string",new ConfigFileInvoker());
Adding an instance to a MEF container的更多相关文章
- Microsoft实现的IOC DI之 Unity 、Service Locator、MEF
这几个工具的站点 Microsoft Unity http://unity.codeplex.com Service Locator http://commonservicelocator.code ...
- Using MEF to Set Up Dependency Injection
The Managed Extensibility Framework (MEF) is a built-in set of elements that allows you to “export” ...
- MEF引起的内存泄露
也许你编程的时候很小心,注意不引起内存泄露,例如不要被全局Static的变量引用上,注意Singleton的static引用,注意Event Handler注销,注意IDisposable接口实现,而 ...
- Laravel之Service Container服务容器
managing class dependencies and performing dependency injection. Dependency injection is a fancy phr ...
- 【总文档】rac增加新节点的方法步骤 How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterware and RAC
[总文档]How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterw ...
- Which dispatch method would be used in Swift?-Existential Container
In this example: protocol MyProtocol { func testFuncA() } extension MyProtocol { func testFuncA() { ...
- java中的重绘
void java.awt.Container.validate()Validates this container and all of its subcomponents.这个函数更新容器及其全部 ...
- Flowplayer-Skin
SOURCE URL: https://flowplayer.org/docs/skinning.html Skinning with CSS3 Flowplayer skin design is C ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
随机推荐
- (三)HttpClient 抓取图片
第一节: HttpClient 抓取图片 这里pom.xml需要用到io输入输出: <dependency> <groupId>commons-io</groupId&g ...
- windows下redis服务操作
安装redis服务redis-server --service-install redis.windows.conf --service-name Redis26380 --loglevel verb ...
- MySQL学习笔记:limit
MySQL支持用limit语句来设置查询的行数范围,同Hive. LIMIT a, b; a:从a+1开始: b:取b行数据: 1.取出第一行记录: ,; 2.取出第二行记录: ,; 3.取出从11开 ...
- CVE-2013-2729 Adobe Reader和Acrobat 数字错误漏洞
这个洞是在论坛里看到的,感觉很有意思,来学习一下.个人感觉IE或者说是浏览器的洞和Adobe洞都是比较难调的,主要是有大量的类难以摸清之间的关系. 这个洞是一个整数溢出的洞,这个不是重点.重点是利用的 ...
- dp入门题目
本文文旨,如题... 转载请注明出处... HDOJ 1176 免费馅饼 http://acm.hdu.edu.cn/showproblem.php?pid=1176 类似数塔,从底往上推,每次都是从 ...
- Struts 2 - Environment Setup
Our first task is to get a minimal Struts 2 application running. This chapter will guide you on how ...
- Kaldi 安装
以后要重点搞caldi了,虽然集群上有,但还是本地安装一下吧. 参考 Kaldi 学习手记(一):Kaldi 的编译安装 在 ubuntu 下安装 kaldi 基本步骤 两个文章基本差不多 1 ...
- 高仿360界面的实现(用纯XML和脚本实现)
源码下载:360UI 本项目XML的桌面渲染依赖GQT开源项目(请感兴趣的朋友加入QQ讨论群:101189702,在群共享文件里下载GQT源码),以下是360界面实现的全部XML代码,所有的代码都在3 ...
- UBB/HTML互相转换简单实现源码一览
查看源码,主要用的就是正则匹配,多的不说,直接读码. 资源原地址:在线UBB/HTML转换 效果图如下 以下源码: <!DOCTYPE html> <html lang=" ...
- [js]DOM 篇
DOM 是 JavaScript 操作网页的接口,全称为“文档对象模型”(Document Object Model).它的作用是将网页转为一个 JavaScript 对象,从而可以用脚本进行各种操作 ...