2
目前我已处理自己的进口的所有类。用一个典型的例子:集中MEF组合
[ImportMany]
private Lazy<ISomeInterface>[] someOfMyInterfaces { get; set; }
public MyConstructor()
{
AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
CompositionContainer container = new CompositionContainer(catalog);
container.ComposeParts(this);
}
现在,我想用一个总目录和需要改变我所有的类,采取进口的实现。我想把这个逻辑放在一个集中的地方。基本上消除我的课程的依赖组成他们自己的部分。有没有什么好的模式可以实现这个目标?
谢谢。我之前遇到过,但我没有意识到发生了什么事。我找到了一个例子,但仍然希望看到更多。 http://randomactsofcoding.blogspot.com/2009/12/managing-composition-through-lazy.html – jhorback 2011-06-04 00:02:23