【问题标题】:Windsor Configuration Standard Practices温莎配置标准实践
【发布时间】: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


【解决方案1】:

查看IWindsorInstaller

另外,如果您来自 StructureMap,this article 可能会有用。

设施有一条细线,但总的来说,设施旨在用于需要自定义配置/多个内部组件等的更复杂的东西。

【讨论】:

  • 我以前怎么没见过这个?完美!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-15
  • 1970-01-01
相关资源
最近更新 更多