2

我记得不久前在一个示例中看到,可以将 windsor 配置文件分解为多个文件,然后从 app.config 中以自动解析的方式引用它们。

当然,我没有为它添加书签,现在我找不到它,而且我的 Windsor.Config.xml 文件正在爬上 600 行。谁能告诉我该怎么做?

目前我只是直接从文件中实例化我的容器: IWindsorContainer container = new WindsorContainer("Windsor.Config.xml");

但我想分解它,引用 app.config 中的 xml 并自动包含它。

4

2 回答 2

1

我认为您的意思是使用包括:

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

您需要做的就是指定一个包含 Uri 的包含节点,该 Uri 将用于创建正确的资源。例如,以下将使用 FileResource:

该文件相对于包含以下内容的配置文件:

<include uri="file://Configurations/facilities.xml">
<include uri="file://Configurations/services.xml">
于 2008-12-11T18:35:59.780 回答
0

您可以使用包含将城堡配置分解为多个文件

于 2008-12-11T18:35:11.840 回答