configurationinversion-of-controlcastle-windsorcontainersmodularity

Windsor Configuration Standard Practices


The app I inherited uses the fluent interface for configuring our Windsor container, and it's this big glob o' configuration that's pretty disgusting.

In the past I created an extension method container.AddModule and then created modules that were passed in the container and registered services a la StructureMap for the different "modules" of my system that need configuration.

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

Is that what facilities are in Windsor? Are the analogous to StructureMap modules or are they extension points for adding super-magic to Windsor?

What is the best-practice for making your container config more modular and less insane?


Solution

  • Check out IWindsorInstaller:

    Also if you're coming from StructureMap this article might be useful.

    There's a thin line with Facilities but in general, facilities are intended to be used for more complex stuff that requires custom configuration / several internal components, etc.