1. public interface IObjectResolver
  2. {
  3. }
  4. public class ObjectResolver:IObjectResolver
  5. {
  6. private CompositionContainer container;
  7.  
  8. public ObjectResolver()
  9. {
  10. container = new CompositionContainer(new AggregateCatalog());
  11. }
  12. public void AddCatalogFile(string fileName)
  13. {
  14. if (!File.Exists(fileName))
  15. throw new FileNotFoundException();
  16. AggregateCatalog catalog = (AggregateCatalog)container.Catalog;
  17. catalog.Catalogs.Add(new AssemblyCatalog(fileName));
  18. container.ComposeParts();
  19. }
  20. public T GetExport<T>(string name)
  21. {
  22. return container.GetExportedValue<T>(name);
  23. }
  24. }

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. Verilog之openMSP430(1)

    openMSP430_IO interrupt Verilog file: omsp_gpio.v //================================================ ...

  2. eclipse离线安装pydev

    首先,下载去http://pydev.org/下载Python的Eclipse插件PyDev. 目前的最新版是PyDev 2.7.1.zip,将压缩文件解压出来.得到features和plugins两 ...

  3. 使用PCL::GPU::遇到问题

    一:使用GPU进行点云分割,理论上可以极大地加快分割速度: 于是对PCL1.7.1进行了编译,回到32位系统,重设QT,编译成功(时间好漫长,一定要配置仔细,否则编译一次又一次浪费更多时间): 使用时 ...

  4. 基准测试-jmeter压力测试activeMQ之一环境安装配置

    jmeter压力测试activeMQ 摘要:linux(CentOS)单机activeMQ安装.window(2008Server)Jmeter配置activeMQ包.Jmeter配置linux监控 ...

  5. pc页面滚动的时候,背景图不动只是页面滚动

    代码如下,直接拷贝出去就能看效果: 用到的方法 background-attachment 属性设置背景图像是否固定或者随着页面的其余部分滚动. <!DOCTYPE html> <h ...

  6. 在fedora「27」下,安装mysql 问题总结

    有时会出现,没有mysql.sock,不存在的问题, Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. ...

  7. let var const

    eslint要求变量声明使用const的,而不是let和var如果可能的话. 如果一个变量只有在声明时才被赋值一次,那么应该使用'const' 'use strict';(function() { v ...

  8. LIS,LCS,LICS 学习笔记

    1.最长上升子序列(LIS) 子序列: 1.可以不连续 2.相对位置不变 dp[i][j] 表示前i位置,最大值为j的LIS长度 1. dp[i-1][j] 前i-1位置,最大值为j的LIS长度 (没 ...

  9. Spring学习总结(19)——Spring概念详解

    Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建.简单来说,Spring是一个分层的JavaSE/EEfull-stack(一 ...

  10. 监控Weblogic计数器