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.
我记得很久以前在一个样本中看到有可能将windsor配置文件拆分成多个并从app.config中引用它们,它们会自动解析。
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?
当然我没有将它加入书签,现在我找不到它,我的Windsor.Config.xml文件正在爬上600行。谁能告诉我怎么做?
Currently I just instantiate my container directly off the file: IWindsorContainer container = new WindsorContainer("Windsor.Config.xml");
目前我只是直接在文件中实例化我的容器: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.
但是我想要分解它,在app.config中引用xml并自动包含它。
2 个解决方案
#1
1
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:
您需要做的就是使用Uri指定包含节点,该节点将用于创建适当的资源。例如,以下将使用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">
#2
#1
1
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:
您需要做的就是使用Uri指定包含节点,该节点将用于创建适当的资源。例如,以下将使用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">