Windsor Configuration Reference
The Windsor Container allows you to use an external file, assembly resources and the configuration associated with the AppDomain as a mean to configure the container.
You can use the configuration to supply configuration parameters to the components and facilities, and to register components and facilities.
A facility will only be instantiated and registered if the type attribute on the configuration is present. The same rule applies to components. For components you can also inform the service using the service attribute.
This document is only focused on the format, not on the code that uses or how they can be externalized. That is covered on the User's guide.
Formal reference
The reference below presents all nodes and attributes that the container uses by default.
You must be aware that most facilities have their own configuration and some of them also check for nodes and attributes on the each component node.
<configuration> <include uri="uri1" /> <include uri="uri2" /> <properties> <connection_string>value here</connection_string> </properties> <!-- used to register components before registering the facilities --> <bootstrap> <component id="" service="" type="" inspectionBehavior="all|declaredonly|none" lifestyle="singleton|thread|transient|pooled|custom" customLifestyleType="type that implements ILifestyleManager" initialPoolSize="<num>" maxPoolSize="<num>"> <parameters> <paramtername>value</paramtername> </parameters> <interceptors> <interceptor>${interceptor.id}</interceptor> </interceptors> </component> </bootstrap> <facilities> <facility id="" type="Facility full type name"> </facility> </facilities> <components> <component id="" service="" type="" inspectionBehavior="all|declaredonly|none" lifestyle="singleton|thread|transient|pooled|custom" customLifestyleType="type that implements ILifestyleManager" initialPoolSize="<num>" maxPoolSize="<num>"> <parameters> <paramtername>value</paramtername> </parameters> <interceptors> <interceptor>${interceptor.id}</interceptor> </interceptors> </component> </components> </configuration>
The table below explains the attributes and nodes.
| Attribute/Node | Required | Description |
|---|---|---|
| id | Yes | The key that identifies a component or facility |
| type | No | The full type name of the facility or component implementation |
| service | No | The full type name of the service (interface) implemented by the component. |
| inspectionBehavior | No | Defines what properties the PropertiesDependenciesModelInspector should extract from the component. Defaults to all |
| lifestyle | No | Defines the component lifestyle. |
| customLifestyleType | No | Only required if the lifestyle=custom. Specify a custom implementation of ILifestyleManager |
| initialPoolSize | No | Only required if the lifestyle=pooled. Defines the initial pool size |
| maxPoolSize | No | Only required if the lifestyle=pooled. Defines the pool maximum size. |
| parameters | No | Specify a list of parameters that the container can use when resolving dependencies. The child nodes should use properties names or constructors arguments names. |
| interceptors | No | Specify a list of interceptors. Should use the reference notation. |
Using includes
The include node is used to link the configuration file with another configuration, thus including its content.
The usage is discussed on the User's guide.
Using properties
The properties node defines global properties that can be use throughout the configuration with the #{} notation which will be described in a section below.
The usage is discussed on the User's guide.
Using defines and statements
You can combine defines and statement to conditionally include or exclude pieces of configuration.
The usage is discussed on the User's guide.
Notations
Some notations can be used to guide the MicroKernel (or the configuration engine) about what you want to do.
Service look up notation
The following notation is used to describe a service reference.
${componentid}
It instructs the MicroKernel to use the specified component as a value for a parameter.
Configuration Property evaluation
This notation is used with a properties node and allows the developer to expand the value on the properties node to as a node value or attribute value.
#{propertyname}