Castle Windsor and its own configuration file
Posted
by Coppermill
on Stack Overflow
See other posts from Stack Overflow
or by Coppermill
Published on 2010-03-31T10:27:14Z
Indexed on
2010/03/31
10:33 UTC
Read the original article
Hit count: 728
I am using Castle Windsor for IoC, and have the configuration held in the web.config
/app.config
, using the following factory:
public static TYPE Factory(string component)
{
var windsorContainer = new WindsorContainer(new XmlInterpreter());
var service = windsorContainer.Resolve<TYPE>(component);
if (service == null)
throw new ArgumentNullException(string.Format("Unable to find container {0}", component));
return service;
}
and my web.config
looking like this:
<configuration>
<configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
</configSections>
<castle>
<components>
<component id="Data" service="Data.IData, Data" type="Data.DataService, Data"/>
</components>
</castle>
<appSettings>.......
Which works fine, but I'd like to place the configuration for Castle Windsor in a file called castle.config
. How do I do this?
© Stack Overflow or respective owner