Registering components using Xml configuration, which can be combined with the code options (Read more)
Registering components one-by-one
What about open generic types?
How to replace an allready registered component?
In Windsor you can simple register it again, the last registered component will be the one used
How to make one class resolvable by two interface but have them share the same instance?
How can i use the decorator pattern?
First let’s create a logging decorator
With Castle Windsor the order of the registrations enables this behavior, so the first implementation will be injected into the decorator.
Registering components by conventions
To do exactly the same but with conventions syntax
WithServiceAllInterfaces: Means windsor will register the component bound to all it’s interfaces, so if for instance your CustomerRepository implements IRepository but also ICustomerRepository, when you resolve an instance, it will be shared across both contracts for the specified lifetime ( transient means no sharing )
Installers provide you a way to group related registrations into one class, to create an installer simply create a class and implement IWindsorInstaller, like this:
To use this installer simple install it on your container instance