Code Bye

No persister for: System.Object[] NHibernate异常

No persister for 已知的4种可能原因:

1、配置文件后缀名写错 mapping file 必须是.hbm.xml结尾

2、Web.config配置里面引用实体

<code><span class="pun"><</span><span class="pln">session</span><span class="pun">-</span><span class="pln">factory</span><span class="pun">></span>
</code>

……………………

<code><span class="pun"><</span><span class="pln">mapping assembly</span><span class="pun">=</span><span class="str">"Project.DomainModel"</span><span class="pun">/></span><span class="pln">  </span><span class="pun"><!--</span> <span class="typ">Here</span> <span class="pun">--></span>
</code>
<code><span class="pun"></</span><span class="pln">session</span><span class="pun">-</span><span class="pln">factory</span><span class="pun">></span>
</code>

3、hibernate 的mapping 配置文件是xml,属性必须设置成“嵌入的资源”。

4、传递给方法Add(object obj)的参数为System.Object[],应为Add(IEnumerable<object> objs)并作相应处理。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明No persister for: System.Object[] NHibernate异常