Hi,
I'm trying to persist a SortedList<DateTime, double?> with NHibernate 2.0. When an item's value (not key) is null, that item is not persisted to the database.
Class snippet:
public class TimeSeries{ ... public TimeSeries(){ Data = new SortedList(); } public virtual IDictionary Data { get; private set; } ... }Mapping snippet:
... <map name="Data" cascade="all" lazy="true" sort="natural" collection-type="sorted-list"> <key column="ID"/> <index type="Date" column="Period"/> <element type="double" column="Value" not-null="false"/> </map> ...Usage snippet:
var series = new TimeSeries(); series.Data.Add(new DateTime(2000, 1, 1), 1); series.Data.Add(new DateTime(2000, 1, 2), null); series.Data.Add(new DateTime(2000, 1, 3), 3); repository.Add(series);
The first and third items are persisted, but not the second. If I change the double value from a null value to a non-null value, it saves fine.
Any idea how I can save the null values? I'm using MySql and the database schema allows for nulls.
Thanks, Marcus