温莎配置标准实践

问题描述 投票:0回答:1

我继承的应用程序使用流畅的界面来配置我们的 Windsor 容器,而这种大的配置非常令人恶心。

过去,我创建了一个扩展方法container.AddModule,然后创建了在容器中传递的模块,并为系统中需要配置的不同“模块”注册了StructureMap服务。

container.AddModule(new FooModule());
...
public class FooModule : IWindsorModule
{
  public Register(IWindsorContainer container)
  {
    container.Register(/*Windsor's Ridiculous Fluent Syntax*/);
  }
}

这就是温莎的设施吗?是否类似于 StructureMap 模块,或者它们是为 Windsor 添加超级魔力的扩展点?

使容器配置更加模块化、不那么疯狂的最佳实践是什么?

configuration inversion-of-control castle-windsor containers modularity
1个回答
1
投票

查看

IWindsorInstaller

此外,如果您来自 StructureMap 这篇文章 可能会有用。

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

© www.soinside.com 2019 - 2024. All rights reserved.