views:

732

answers:

2

I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically.

Of course I didn't bookmark it and now I can't find it and my Windsor.Config.xml file is creeping up on 600 lines. Can anyone tell me how to do this?

Currently I just instantiate my container directly off the file: IWindsorContainer container = new WindsorContainer("Windsor.Config.xml");

But I'd like to break it up, reference the xml in the app.config and have it included automatically.

A: 

You can break the castle configuration into several files using includes

gcores
+1  A: 

I think you mean using includes:

http://www.castleproject.org/container/documentation/v1rc3/usersguide/includes.html

All you need to do is specify an include node with the Uri that will be used to create the proper Resource. For example, the following will use the FileResource:

The file is relative to the configuration file that has the include:

<include uri="file://Configurations/facilities.xml">
<include uri="file://Configurations/services.xml">
Watson
This is also useful for non-file based resources, i.e. you can provide your own resource subsystem to the container and then use custom uri schemes in your includes to pull in resources from other places - i.e. server://properties.xml.
Bittercoder