Hi Ricardo
Thanks for your reply. I'm afraid i havn't made any progress yet. I
tried to change the signature of the Data property with two different
implementations. In the first I use a private field, so I'm able to
initialse the field in the constructor. In the second I use an auto-
implemented property (which I think is the one that u suggest).
However both of these of these implementations gives me the
NullReferenceException when calling
Configuration.BuildSessionFactory().
Does anyone have a code example of how to map a SortedList<,>?
Thank you
TestEntity implementation 1:
namespace Domain
{
public class TestEntity
{
private SortedList<DateTime, string> _data;
public TestEntity()
{
_data = new SortedList<DateTime, string>();
}
public virtual Guid Id { get; set; }
public virtual IDictionary<DateTime, string> Data
{
get { return _data; }
set
{
_data = value is SortedList<DateTime, string>
? (SortedList<DateTime, string>)value
: new SortedList<DateTime, string>(value);
}
}
}
}
TestEntity implementation 2:
namespace LiveBall.Domain.Participant
{
public class TestEntity
{
public TestEntity()
{ }
public virtual Guid Id { get; set; }
public virtual IDictionary<DateTime, string> Data
{
get;
set;
}
}
}
TestEntity.hbm.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Domain" namespace="Domain">
<class name="TestEntity">
<id name="Id">
<generator class="guid" />
</id>
<map name="Data" sort="natural">
<key column="EntityId" />
<index column="time" type="DateTime" />
<element column="value" type="String" />
</map>
</class>
</hibernate-mapping>
> > 'NHibernate.Collection.Generic.PersistentGenericMap`2[System.DateTime,System.String]'