views:

60

answers:

1

I have a website that relies on dependency injection, using Castle Windsor.

I need to use a component that needs to know the path to a file. I would like to specify the path in the configuration file as a virtual path relative to the web site root directory, so I would do this:

<component id="configuration.documentLoader"  type="SomeModule.XmlDocumentLoader, SomeModile">
 <parameters>
     <FileName>/documents/file.dat</FileName>
 </parameters>
</component>

However, the component I am using expects the path to be the full physical path, so the example above would fail. Writing the full path in the configuration file is not an option.

How would you solve this ?

I was thinking about adding another component that would do the translation, and have my current component rely on that component. Is this overkill ? Is there a more elegant way to solve this without changing the already existing components ?

+2  A: 
IContributeComponentModelConstruction

you could use that to switch the relative path to absolute.

Krzysztof Koźmic