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的更多相关文章

  1. MEF and AppDomain z

    MEF and AppDomain - Remove Assemblies On The Fly This article will give an idea of what's involved i ...

  2. 【转载】保哥 釐清 CLR、.NET、C#、Visual Studio、ASP.NET 各版本之間的關係

    我常常不仅仅逛 博客园,还会去找国外,特别是台湾的技术部落格,发现好的文章,我便会收录,今天我转载或者全文复制,在Google 博客园,一位叫保哥, 釐清 CLR..NET.C#.Visual Stu ...

  3. CLR/.NET/C#/Visual Studio/ASP.NET各版本之间的关系(转)

    由于这篇文章记录的是2015年7月,那时.net core还是叫做.net core 5 名词定义 下列这些名词,写.NET 的人一定都不陌生,但你是否有真正理解呢?如果看了我的摘要文字说明还无法理解 ...

  4. Windows、VS 与 .net

    原文地址:https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx .NET Framework version CLR ver ...

  5. 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 ...

  6. .NET Framework各版本特性一览

    https://msdn.microsoft.com/en-us/library/bb822049.aspx .NET Framework version CL version Features In ...

  7. 使用MEF实现通用参数设置

    通用后台管理系统必备功能模块包含日志管理,权限管理,数据字典,参数配置等功能.参数设置主要用于设置系统运行所需的一些基础性配置项,比如redis缓存,mq消息队列,系统版本等信息.好的参数设置需要达到 ...

  8. PopupWindowAction breaking MEF import?

    If you use Prism InteractionRequest.PopupWindowAction feature, you might have found the MEF Import a ...

  9. MEF(Managed Extensibility Framework) 微软平台插件化开发

    体验Managed Extensibility Framework精妙的设计   MEF(Managed Extensibility Framework)是.NET Framework 4.0一个重要 ...

随机推荐

  1. 从Spark1.6到Spark2.1,Logging该何去何从

    大家都知道spark 1.6.0版本比较稳定,也比较流行. 我们项目组也是,最初用的就是这个版本. 这段时间,项目组引入spark 2.1.0版本,我想尝尝鲜. Pom中刚刚换了dependency马 ...

  2. WinRAR 5.60 无广告正式版

    首先明确WinRAR唯一的官网是这个 https://www.rarlab.com/ 其余的都不要相信. 现在的问题是:不要脸的中国代理强行捆绑广告:即使你花钱注册同样要面对弹窗广告!这就不可接受了! ...

  3. Jenkins 部署 PHP 应用

    安装 Jenkins 方式一:docker方式安装 拉取jenkins官方镜像,按照镜像文档启动镜像就可以了 方式二:手动安装 以下所有操作都使用 root 用户进行操作. 在各项目官网,下载 Jav ...

  4. Linux下mysql 忘记密码的解决办法

    >mysql -u root -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \ ...

  5. Tomcat在处理POST和GET提交方式时的字符编码问题

    部分内容参考http://yejg1212.blog.163.com/blog/static/3958206120098384327191(原作者:飞翔)  一.POST和GET请求方式的区别: 在默 ...

  6. 【BZOJ2806】【CTSC2012】Cheat - 广义后缀自动机+单调队列优化DP

    题意: Description Input 第一行两个整数N,M表示待检查的作文数量,和小强的标准作文库的行数 接下来M行的01串,表示标准作文库 接下来N行的01串,表示N篇作文 Output N行 ...

  7. 用SufaceGO加微软全家桶做个遥控车(一)

    作为一个dotnet技术的新手我是不好意思写帖子的,原因就是本人技术太水了,写出的帖子肯定会让人笑话.所以这次我是厚着脸皮写出这个帖子的,希望大佬们轻喷了.我的目标就是用SurfaceGo实现一个和我 ...

  8. 交互式编程之Golang基本配置(Jupyter-notebooks Golang)

    JupyterNoteBook-GO 启动错误 Install Go Install gophernotes 参考资料 如有错误,欢迎指出 错误 error: Cannot assign reques ...

  9. 【AIM Tech Round 5 (rated, Div. 1 + Div. 2) A】 Find Square

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找到左上角.往下一直走,往右一直走走到B边界就好. 中点的话.直接输出中位数 [代码] #include <bits/stdc ...

  10. PHP学习总结(7)——PHP入门篇之PHP注释

    注释 在PHP中也有注释语句:用双斜杠(//)来表示.其它语言中,Html中使用<!--注释语句-->,CSS中使用/*注释语句*/.如下面代码: <?php//输出hi,imooc ...