Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, since there is no feedback yet, here's what we did to make it (more or less) work:</p> <ul> <li><p>First, to be able to save a new ClientCountry(many to many with exposed junction table), we must do this:</p> <pre><code>public class ClientCountryMap : BaseMapping&lt;ClientCountry&gt; { public ClientCountryMap() { Property(x =&gt; x.ValidFrom); Property(x =&gt; x.ValidTo); Property(x =&gt; x.ClientId, map =&gt; { map.Column("ClientId"); map.Insert(true); map.Update(true); map.NotNullable(true); }); Property(x =&gt; x.CountryId, map =&gt; { map.Column("CountryId"); map.Insert(true); map.Update(true); map.NotNullable(true); }); ManyToOne&lt;Client&gt;(x =&gt; x.Client, map =&gt; { map.Column("ClientId"); map.Cascade(Cascade.All); map.Insert(false); map.Update(false); map.NotNullable(true); }); ManyToOne&lt;Country&gt;(x =&gt; x.Country, map =&gt; { map.Column("CountryId"); map.Cascade(Cascade.All); map.Insert(false); map.Update(false); map.NotNullable(true); }); } } </code></pre> <p>The difference here is that the insert/update are inverted. <code>Insert(true)</code> and <code>Update(true)</code> must be set on the foreign key mapping and not the association. It differs from the <a href="http://www.breezejs.com/documentation/nhibernate-support" rel="nofollow">breeze doc</a> on that point.</p></li> <li><p>The second is that <code>Inverse(true)</code> must be set on each collection association or all your collections will be deleted when updating the parent entity. </p></li> </ul> <p>With that,changes, it seems to work as expected.</p> <p><strong>ps: It is fixed in the latest version (>1.4.8). The comments above don't apply anymore.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload