ComponentModel construction contributors

ComponentModel construction contributors are objects that implement IContributeComponentModelConstruction interface. As their name implies they construct the ComponentModel into its final state right after it was created.

Don't modify ComponentModel outside of contributors

It is discouraged to modify component model elsewhere than in construction contributors. After ComponentModel is processed by its construction contributors it should be considered read only. Modifying it at any later point may lead to concurrency issues and other kinds of hard to track down issues.

ComponentModel construction contributors are required to implement single method:

void ProcessModel(IKernel kernel, ComponentModel model);

Based on the information provided by other contributors, kernel, model's configuration or its own state they either inspect or modify the model parameter. Windsor uses several of built in contributors itself to set up things like proxying, parameters, lifestyles, lifecycle steps, dependencies etc.

Writing custom contributor is one of the most common ways of extending/customizing Windsor. For the sake of example let's say we want to make all properties of type ILogger on all components to be mandatory (By default property dependencies are optional in Windsor). To do that we could write a contributor that looks like the following: