Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are two possible issues in your code.</p> <ol> <li><strong>Imagem.Bytes</strong> property is lazy-loaded but lazy loading for <strong>Imagem</strong> istself is disabled. It means no proxy is generated for <strong>Imagem</strong> instances and <strong>Bytes</strong> cannot be lazy-loaded: mission impossible (at least it appears to me right now, not sure). Simple load from database (<code>session.Get&lt;Imagem&gt;(id);</code>) leads to exceptions like this: <code>Invalid Cast (check your mapping for property type mismatches); setter of Imagem</code>. Solution is to enable lazy-loading on Imagem or disable lazy loading on <strong>Bytes</strong> property.</li> <li>PersistenceSpecification loads tested entity from database <a href="https://github.com/jagregory/fluent-nhibernate/blob/master/src/FluentNHibernate/Testing/PersistenceSpecification.cs#L56" rel="nofollow">as another instance</a>. It means that default equality comparer does not work well. You need to provide your own equality comparer to solve this issue (check this for more details).</li> </ol> <p>Here is <a href="http://pastie.org/2640070" rel="nofollow">Receita</a> and <a href="http://pastie.org/2640077" rel="nofollow">Imagem</a> entities, implementation of <a href="http://pastie.org/2640080" rel="nofollow">IEqualityComparer</a> and <a href="http://pastie.org/2640085" rel="nofollow">PersistentSpecification</a> snippet. This code works well in NH3.1 and FNH 1.2. Please, let me know if your code differs somehow from these snippets.</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