NHibernate: mapping bidirectional one-to-many with IList semantics -


here relevant pieces. parent object:

public class article {     public virtual ilist<articlerevision> revisions { get; set; } }  <list name="revisions" cascade="all" inverse="true" table="articlerevision">   <cache usage="read-write" />    <key column="articleid" not-null="true" />   <index column="number" type="int32" />   <one-to-many class="articlerevision" /> </list> 

this child:

public class articlerevision {     public virtual article article { get; set; } }  <many-to-one name="article" column="articleid" not-null="true" /> 

now, create instance of article, add 1 articlerevision article.revisions collection, set articlerevision.article reference article instance , shove database:

insert      articlerevision     (content, keywords, createdat, siteid, articleid, createdbyuserid, id)  values     (@p0, @p1, @p2, @p3, @p4, @p5, @p6); 

no number column gets inserted.

how correctly map bidirectional one-to-many collection list semantics in nhibernate?

from nhibernate documentation:

please note nhibernate not support bidirectional one-to-many associations indexed collection (list, map or array) "many" end, have use set or bag mapping.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -