如何从子对象向字典中添加条目,定义在父对象中?
*更新 我编辑我的配置如下:
<object id="ParentType" singleton="false" type="SomeType">
<property name="FieldNameMap">
<dictionary key-type="string" value-type="string" >
<entry key="Title" value="TitleName"/>
</dictionary>
</property>
</object>
<object id="ChildType" singleton="false" type="SomeType" parent="ParentType">
<property name="FieldNameMap">
<dictionary merge="true">
<!-- this entry should be added to, not replace the whole Dictionary -->
<entry key="Position" value="PositionName"/>
</dictionary>
</property>
</object>
但是,不幸的是,它现在抛出异常:
无法将类型 [System.Collections.Specialized.HybridDictionary] 的属性值转换为所需类型 [System.Collections.Generic.IDictionary`2[[System.String, ],[System.String, mscorlib, Version=4.0.0.0, Culture =中性,PublicKeyToken=b77a5c561934e089]]