我有一个包含属性的对象:
public Dictionary<string, List<Hotel>> CityHotels { get; set; }
Run Code Online (Sandbox Code Playgroud)
如何使用Spring.Net配置此属性?
我试过这样做:
<property name="CityHotels">
<dictionary key-type="string" value-type="System.Collections.Generic.List<MyNameSpace.Hotel, MyAssembly>" >
<entry key="SYD">
<list element-type="MyNameSpace.Hotel, MyAssembly">
</list>
</entry>
</dictionary>
</property>
Run Code Online (Sandbox Code Playgroud)
但它没有成功:
创建上下文'spring.root'时出错:无法从字符串值'System.Collections.Generic.List`2'加载类型.
我究竟做错了什么?
在我尝试使用Spring.Net设置ILookup类型的属性失败之后,出现了这个令人费解的混乱,所以如果有办法做到这一点,那将以更清洁的方式解决我的问题.