我是温莎城堡的新手,对配置文件中的顺序感到困惑。这取自 GettingStarted1 示例。HttpServiceWatcher 类在其构造函数中采用 IFailureNotifier 实现器。但是,无论我如何订购实现此接口的两个组件——AlarmFailureNotifier 和 EmailFailureNotifier——我总是得到 EmailFailureNotifier。我知道您可以覆盖使用参数和“服务查找”参考选择的选项,但我认为在其他机制不使用时使用声明顺序。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" />
</configSections>
<castle>
<components>
<component
id="httpservicewatcher"
type="GettingStartedPart1.HttpServiceWatcher, GettingStartedPart1">
</component>
<component
id="alarm.notifier"
service="GettingStartedPart1.IFailureNotifier, GettingStartedPart1"
type="GettingStartedPart1.AlarmFailureNotifier, GettingStartedPart1" />
<component
id="email.notifier"
service="GettingStartedPart1.IFailureNotifier, GettingStartedPart1"
type="GettingStartedPart1.EmailFailureNotifier, GettingStartedPart1" />
<component
id="form.component"
type="GettingStartedPart1.Form1,GettingStartedPart1" />
</components>
</castle>
</configuration>