Castle Windsor を初めて使用し、構成ファイルの順序について混乱しています。これは GettingStarted1 サンプルから取得したものです。HttpServiceWatcher クラスは、そのコンストラクターで IFailureNotifier 実装者を取ります。ただし、このインターフェイスを実装する 2 つのコンポーネント (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>