Hi
I was wondering if someone could lend a quick hand with this. I have an IDictionary<string, int> that I am having problems persisting (the other parts save ok). I have the following class and mapping files defined. Is there anything special I need to do for an IDictionary?
Thanks for any help.
Joe
Code:
public class ParkedBasket
{
private int _ParkedBasketId;
private Guid _UserId;
private string _BasketName;
private DateTime _SaveDate;
private IDictionary<string, int> _LineItems = new Dictionary<string, int>();
public int ParkedBasketId
{
get { return _ParkedBasketId; }
set { _ParkedBasketId = value; }
}
public Guid UserId
{
get { return _UserId; }
set { _UserId = value; }
}
public string BasketName
{
get { return _BasketName; }
set { _BasketName = value; }
}
public DateTime SaveDate
{
get { return _SaveDate; }
set { _SaveDate = value; }
}
public IDictionary<string, int> LineItems
{
get { return _LineItems; }
set { _LineItems = value; }
}
public ParkedBasket() { }
}
And the following XML mapping file
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Orders" assembly="Orders" >
<class name="ParkedBasket" table="ParkedBasket" lazy="false">
<id name="ParkedBasketId" column="ParkedBasketId" unsaved-value="0">
<generator class="native" />
</id>
<property name="UserId" />
<property name="BasketName" />
<property name="SaveDate" />
<map name="LineItems" generic="true" table="_ParkedBasketItems" cascade="all" collection-type="IDictionary" >
<key column="ParkedBasketId" foreign-key="ParkedBasketId" />
<index column="CatalogNumber" type="string" />
<element type="int" column="Quantity" />
</map>
</class>
</hibernate-mapping>