Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

castle windsor: how to use a Type as constructor property in xml config?

I have the following:
TypeUser:ITypeUser
{
public TypeUser(Type usedType){..}
}

How do i configure the Type parameter in windsor config xml?

like image 771
Jesper Kihlberg Avatar asked Dec 03 '25 20:12

Jesper Kihlberg


1 Answers

For custom types you need provide a type converter to handle the conversion, however "Type" is supported out of the box (if you take a look at the list here on the castleproject site) and should "just work" i.e. like so:

<component id="myServer" service="SomeNameSpace.ITypeUser, SomeAssembly" type="SomeNameSpace.TypeUser, SomeLib">
    <parameters>
        <usedType>SomeNameSpace.MyOtherType, SomeAssembly</usedType>
    </parameters>
</component>
like image 146
Bittercoder Avatar answered Dec 06 '25 16:12

Bittercoder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!