Equivalent of Spring's "parent" in Castle Windsor
In Spring Framework (both for java and .net) i can use the following definition of objects:
<object id="parentObject" type="Type1" abstract="true">
<property name="name" value="parent"/>
<property name="age" value="1"/>
</object>
<object id="childObject" type="Type2" parent="parentObject">
<property name="name" value="override"/>
<!-- age will inherit value of 1 from parent -->
</object>
Note for parent attribute. It is a kind of templating (inheriting of configuration definitions)
Definit开发者_JS百科ion of this attribute: http://www.springframework.net/docs/1.3.0/reference/html/objects.html#objects-childobjects
What is an equivalent for this in Castle Windsor?
Windsor has ability to define your components in code which is waaaaay more powerful and it's a recommended way. You can do the "parent" trick by extracting the common code to a helper method.
Config in Windsor is considered legacy, and should not be used except for very limited cases, so in reality you shouldn't need that at all.
When you say "inherit configuration definition", are you referring to the property values? You can define a common set of parameters and reference them throughout the config. See the Windsor XML reference and the "parameters" node.
精彩评论