Hi Ollie,
maybe the dict sytax helps (not sure if it can create complex types):
public ComponentWithConfigs(string name, int port, IDictionary dict)
{
this.name = name;
this.port = port;
this.dict = dict;
}
<component id="component"
type="Castle.Windsor.Tests.Components.ComponentWithConfigs,
Castle.Windsor.Tests">
<parameters>
<name><?eval $BaseDirectory?></name>
<port>90</port>
<dict>
<dictionary>
<entry key="key1">value</entry>
</dictionary>
</dict>
</parameters>
</component>
On Mon, Apr 6, 2009 at 11:07 AM, Ollie Riches
<[email protected]>wrote:
>
> I want to auto-wire an object that takes a dictionary as a constructor
> parameter where the key (of the key value pair) is not a simple type.
> I've managed this with a string as the key, but I want to use an
> instance of a class created via the container.
>
> <component id="IResourceDirectory"
> service="XXX.Interfaces.IResourceDirectory,
> XXX.EndpointMapper.Core"
> type="XXX.Core.Infrastructure.ResourceDirectory,
> XXX.EndpointMapper.Core"
> lifestyle="transient">
> <parameters>
> <handlers>
> <dictionary keyType="XXX.Core.QueryableTree.Query,
> XXX.EndpointMapper.Core"
>
> valueType="XXX.Core.Interfaces.IRequestHandler,
> XXX.EndpointMapper.Core">
> <item key="${GetQuery}">${GetHandler}</item>
> <item key="${PutQuery}">${PutHandler}</item>
> </dictionary>
> </handlers>
> </parameters>
> </component>
>
> I can't get Castle to create ${GetQuery} or ${PutQuery} as the key for
> items in the dictionary even though they are defined in the castle
> config correctly.
>
> Is this possible and how do I do it?
>
>
> Cheers
>
> Ollie
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---