MEF导入部分本地配置上下文

时间:2013-09-12 18:47:50

标签: c# .net mef

我的目标是设置依赖注入,以便使用与任何特定组合部分相关的配置文件而不是容器的配置。 换句话说:

项目1:PluginBase

项目2:

  • PluginImplementation : PluginBase
  • 构造函数:
public PluginImplementation()
{
    var myConfig = ConfigurationManager.GetSection("myConfigSection");
}
  • 的App.config

项目3:

  • PluginContainer
  • App.config

通常,当“Project 3”调用PluginContainer.ComposeParts时,会调用构造函数PluginImplementation(),隐含的ConfigurationManager.GetSection("myConfigSection")源代码为Project 3> App.config。

是否可以更改此行为,以便源是Project 2 - > App.Config?

0 个答案:

没有答案
相关问题