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 ...
随机推荐
- Luogu P4894 【GodFly求解法向量】
个人感觉我的解法比官方题解好理解得多 因为是任意一个法向量嘛,不妨设$x=1$ 然后解一个二元一次方程就可以解决了 但是因为要求输出三个整数 代码 #include<iostream> # ...
- Sqlserver双机热备文档(无域)
1. 配制环境 OS:Win7 DB:SQL Server R2 2. 基本配制 1. 开启sqlServer服务如下图-1 图-1 2. 开启sqlServer的tcp/i ...
- CVE-2010-0248
[CNNVD]Microsoft Internet Explorer 多个远程代码执行漏洞(CNNVD-201001-237) Microsoft Internet Explorer 6, 6 SP1 ...
- 题解-python-CodeForces 227B
用hash解决.我python代码消耗很多内存,好在代码比C++短很多 n = int(raw_input()) mylist = raw_input().split(' ') i = 0 zid = ...
- RabbitMQ系列之RabbitMQ单机安装
安装epel源 rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm #ht ...
- HBase(三)HBase架构与工作原理
一.系统架构 注意:应该是每一个 RegionServer 就只有一个 HLog,而不是一个 Region 有一个 HLog. 从HBase的架构图上可以看出,HBase中的组件包括Client.Zo ...
- USACO 5.5 Hidden Password
Hidden Password ACM South Eastern Europe -- 2003 Sometimes the programmers have very strange ways of ...
- Django实战(20):分页(Pagination)
在上一节我们实现了针对某个产品的订单订阅功能.但是我们可能需要直接在站点上查询所有的订单.显然,随着时间的增长订单会越来越多,所以分页(Pagination)是个好办法:每次只显示一部分订单. 分页是 ...
- 41:和为S的两个数
import java.util.ArrayList; import java.util.Collections; /** * 面试题41:和为S的两个数 * 输入一个递增排序的数组和一个数字S,在数 ...
- TI科学家谈浮点DSP未来发展
自十多年前浮点数字信号处理器(DSP)诞生以来,便为实时信号处理提供了算术上更为先进的备选方案.不过,定点器件至今仍是业界的主流.当然低成本是主要原因.定点DSP每器件产品的价格很低,这对大规 ...