MEF example code
public interface IObjectResolver
{
}
public class ObjectResolver:IObjectResolver
{
private CompositionContainer container; public ObjectResolver()
{
container = new CompositionContainer(new AggregateCatalog());
}
public void AddCatalogFile(string fileName)
{
if (!File.Exists(fileName))
throw new FileNotFoundException();
AggregateCatalog catalog = (AggregateCatalog)container.Catalog;
catalog.Catalogs.Add(new AssemblyCatalog(fileName));
container.ComposeParts();
}
public T GetExport<T>(string name)
{
return container.GetExportedValue<T>(name);
}
}
MEF example code的更多相关文章
- MEF and AppDomain z
MEF and AppDomain - Remove Assemblies On The Fly This article will give an idea of what's involved i ...
- 【转载】保哥 釐清 CLR、.NET、C#、Visual Studio、ASP.NET 各版本之間的關係
我常常不仅仅逛 博客园,还会去找国外,特别是台湾的技术部落格,发现好的文章,我便会收录,今天我转载或者全文复制,在Google 博客园,一位叫保哥, 釐清 CLR..NET.C#.Visual Stu ...
- CLR/.NET/C#/Visual Studio/ASP.NET各版本之间的关系(转)
由于这篇文章记录的是2015年7月,那时.net core还是叫做.net core 5 名词定义 下列这些名词,写.NET 的人一定都不陌生,但你是否有真正理解呢?如果看了我的摘要文字说明还无法理解 ...
- Windows、VS 与 .net
原文地址:https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx .NET Framework version CLR ver ...
- How to Make Portable Class Libraries Work for You
A Portable Class Library is a .NET library that can be used (in binary form, without recompiling) on ...
- .NET Framework各版本特性一览
https://msdn.microsoft.com/en-us/library/bb822049.aspx .NET Framework version CL version Features In ...
- 使用MEF实现通用参数设置
通用后台管理系统必备功能模块包含日志管理,权限管理,数据字典,参数配置等功能.参数设置主要用于设置系统运行所需的一些基础性配置项,比如redis缓存,mq消息队列,系统版本等信息.好的参数设置需要达到 ...
- PopupWindowAction breaking MEF import?
If you use Prism InteractionRequest.PopupWindowAction feature, you might have found the MEF Import a ...
- MEF(Managed Extensibility Framework) 微软平台插件化开发
体验Managed Extensibility Framework精妙的设计 MEF(Managed Extensibility Framework)是.NET Framework 4.0一个重要 ...
随机推荐
- Spring AOP理解
Spring的核心思想的IOC和AOP.最近学习AOP,对切面的学习有了进一步的认识. Spring用代理类包裹切面,把他们织入到Spring管理的bean中.也就是说代理类伪装成目标类,它会截取对目 ...
- java学习笔记3——异或
异或原理: 转换两个字符或数为2进制的ASCII码,再按位异或,即 0001 0001 ---> 0000 0000 0000 ---> 0000 0001 0000 ---> 00 ...
- spring的HandlerMapping
handerlMapping意思是处理器映射,是把请求的url地址与方法进行映射,如SimpleUrlHandlerMapping.
- AngularJS指令进阶 -- ngModelController详解
大家都知道AngularJS中的指令是其尤为复杂的一个部分,但是这也是其比较好玩的地方.这篇文章我们就来说一说如何在我们自定义的指令中,利用ngModel的controller来做双向数据绑定,本文对 ...
- BZOJ 1123: [POI2008]BLO 求割点_乘法原理_计数
Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n&l ...
- windows mongodb启动
D:\MongoDB\bin\mongod.exe --service --dbpath D:\MongoDB\data --logpath=D:\MongoDB\logs\mongodb.log - ...
- 【udacity】机器学习-决策树
Evernote Export 1.监督学习 我们向系统中输出样本,并且告诉系统样本标签(target),系统用我们给出的不同样本的成功与失败的信息,构建它对成功或失败的因素的理解. 2.分类与回归之 ...
- int rc = -EINVAL是什么意思
rc应该是return code的意思,将函数返回值rc初始化为-EINVAL,EINVAL由POSIX.1规范中的一个宏,一般通过包含C标准头文件errno.h,表示参数无效(invalid arg ...
- C语言求大数的阶乘
我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,该如何计算? 当一个数很大时,利用平常的方法是求不出来它的阶乘的,因为数据超出了范围.因此我们要用数组来求一个大数的阶乘,用数组的每位表示结果的 ...
- 移植Mplayer到OK6410开发板
移植Mplayer到OK6410开发板 作者:vasage 项目需要,需要将Mplayer移植到开发板上,所以今天花了一下下午成功移植,其中参考很多文档,后发现许多文档陈旧,些许文档有少量错误,所以这 ...