The Registration API provides a fluent method of registering and configuring components. It is the recommended way of doing so, over meticulous registration in XML. It can be used as an alternative or in addition to XML configuration, with the advantage that it is typed and will be easier to include in refactoring. It may also be advantageous to mix it with some XML.
are both required. You need to add a using directive to
in order to use this API. The examples which follow assume you have created the Windsor Container thusly:
IWindsorContainer container = new WindsorContainer();
We will use the container instance throughout the API documentation.
Registering components one-by-one
Fluent API has ability to register components on a one-by-one basis, where you can explicitly configure all aspects of the component. (read more
Registering components by convention
Recommended approach to registering components is to do it using convention driven approach, which can significantly reduce friction and amount of code required to configure the application. (read more
Registering interceptors and proxy options
If you're interested in advanced topics, like pieces of the API targeted at extending the components read advanced topics
Using with Xml Configuration
If you need to mix both styles of registration there are two options. If the Xml configuration can happen first, simply use the constructor overload that takes an Xml file name before using the fluent api for the rest.
IWindsorContainer container = new WindsorContainer("dependencies.config");
If the fluent registrations must happen first, add the following after all of your fluent calls.