【发布时间】:2010-07-30 19:02:30
【问题描述】:
我继承的应用程序使用流畅的界面来配置我们的Windsor容器,而且这种大球配置非常恶心。
过去,我创建了一个扩展方法 container.AddModule,然后创建了在容器中传递的模块,并为我的系统中需要配置的不同“模块”注册了一个结构映射服务。
container.AddModule(new FooModule());
...
public class FooModule : IWindsorModule
{
public Register(IWindsorContainer container)
{
container.Register(/*Windsor's Ridiculous Fluent Syntax*/);
}
}
这就是温莎的设施吗?是类似于 StructureMap 模块还是它们是为 Windsor 添加超级魔法的扩展点?
使您的容器配置更加模块化和不那么疯狂的最佳实践是什么?
【问题讨论】:
-
James - 设施是容器的扩展,增加了新的功能stw.castleproject.org/Windsor.Facilities.ashx 你觉得 Windsor 的语法有什么可笑的?我很高兴听到你详细说明这一点。您可以加入 Google 群组上的 Castle Users 群组吗?干杯
标签: configuration inversion-of-control castle-windsor containers modularity