我想只使用 xml(没有流利的 API)来配置统一容器,我有一个复杂的任务。我有一个看起来像这样的界面
public interface ISettingsDistributor {
String TargetProperty;
}
及其实现SettingsDistributor
public interface ISettingsConsumer { }
public class SettingsConsumer :ISettingsConsumer, OtherType {
public SettingsConsumer(String theParameter) : base(theParameter) {
}
}
这是该设置的消费者。以下是我目前构建的配置部分。(typeAliases和其他东西省略了)
<containers>
<container name="container">
<types>
<type type="ISettingsDistributor" mapTo="SettingsDistributor">
<lifetime type="singleton" />
</type>
<type type="ISettingsConsumer" mapTo="SettingsConsumer">
<lifetime type="perThread" />
</type>
</types>
</container>
</containers>
我如何在这个 xml 文件中对统一说,当它尝试解析类型时ISettingsConsumer,它应该首先解析并将其成员作为值ISettingsDistributor注入构造函数?TargetProperty