I have an object that contains a property:
public Dictionary<string, List<Hotel>> CityHotels { get; set; }
How do I use Spring.Net to configure this property?
I tried doing this:
<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>
but it was unsuccessful:
Error creating context 'spring.root': Could not load type from string value 'System.Collections.Generic.List`2'.
What am I doing wrong?
This convoluted mess came about after I unsuccessfully tried to use Spring.Net to set a property of type ILookup, so if there is a way to do that, that would solve my problem in a cleaner way.
Solution for the spring config:
In the value-type of the dictionary you don't need to add MyAssembly but mscorlib for
System.Collections.Generic.List
.I hope this will help you!