Dictionary won't persist with NHibernate 3.0 -


i have following entity:

public class alert {     public virtual int id { get; set; }     public virtual string name { get; set; }     public virtual idictionary<cxchannel, string> messages { get; set; } }  public enum cxchannel {     message,     email } 

and following mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">   <class name="entities.alert, entities" table="alert">   <id name="id" type="int" unsaved-value="0" access="property">     <generator class="identity"/>   </id>    <property name="name" column="name"/>     <map name="messages" table="alert_message" cascade="all">       <key column="alert_id"/>       <index column="channel" type="entities.cxchannel, entities"/>       <element column="message" type="system.string"/>     </map>   </class> </hibernate-mapping> 

the problem when save alert entity, messages dictionary not persisted database. matter of fact code looks code oren used in blog post: http://ayende.com/blog/archive/2009/06/03/nhibernate-mapping-ndash-ltmapgt.aspx

has experienced same issue?

verify channel column integer in schema cxchannel enum mapped 0 (for message) , 1 (for email). pasted code , mappings console project, used new schemaexport(cfg).execute(false, true, false), , inserted rows generated database.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -