在编写后将组件添加到MEF容器中

时间:2012-02-02 18:10:58

标签: mef

我可以在编写后将容器添加到容器中吗?我想实现按需组装加载。我不想使用DirectoryCatalog,因为启动时间太长。 (有很多组装)。我希望在用户交互后加载特定的程序集。

谢谢。

1 个答案:

答案 0 :(得分:0)

你可以发布你的代码什么动作导致长的加载时间。但如果mef应该创建你的对象而这个创作需要花费很多时间你没有机会减少这个时间?或者我弄错了什么?

public void Startup
{
    //if this takes a long time, 
    //it would be take a long time even not related assemblies are not in your container
    var myclass = cc.GetExport<MyType>();//or cc.ComposeParts(this);

}
相关问题