【发布时间】:2011-12-08 19:06:11
【问题描述】:
在 C#.NET4.0 和 Windsor castle IoC Framework v2.5.3 中, 是否可以配置嵌入字典?
我尝试了一些配置(见下文)但没有成功。
这里是 Components.xml 文件
<component
id="MyComponent"
service="MyAssembly.IMyInterface,MyAssembly"
type="MyAssembly.MyClass,MyAssembly">
<parameters>
<MyProperty>#{MyComplexDictionaryProperty}</MyProperty>
</parameters>
</component>
这里是 ComponentsProperties.xml 文件:
<MyComplexDictionaryProperty>
<Dictionary
keyType="MyAssembly.MyEnum1,MyAssembly"
valueType="... ??? ...">
<Entry key="MyEnum1Value1">
<Dictionary
keyType="MyAssembly.MyEnum2,MyAssembly"
valueType="System.Int32, mscorlib">
<Entry key="MyEnum2Value1">1</Entry>
</Dictionary>
</Entry>
</Dictionary>
</MyComplexDictionaryProperty>
谢谢:-)
【问题讨论】:
-
我认为如果你有字典,温莎的配置是你最少的问题。在我看来你在滥用原语
标签: c# .net-4.0 dictionary castle-windsor ioc-container