我使用温莎城堡作为国际奥委会的场地,并在
web.config
/
app.config
,使用以下工厂:
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;
}
还有我的
Web.CONFIG
看起来像这样:
<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>.......
很好,但我想把温莎城堡的配置放在一个名为
castle.config
. 我该怎么做?