"ESLG.CommonUtility.NHibernateHelper"的类型初始值设定项引发异常

原因:

     程序调用NHibernateHelper时,会编译配置文件hibernate.cfg.xml中包含的映射文件,如果某个映射文件中的实体类属性与数据库不能映射,即会报这个错误。

解决方案:

   跟踪测试错误:

 

  点击“查询详细信息”可以看到详细错误原因:

在提示框中可以看到如下信息:

Message:"Could not compile the mapping document: ESLG.Entity.PayBillingClient.hbm.xml"

InnerException [NHibernate.PropertyNotFoundException]

{"Could not find a getter for property 'LastOwe' in class 'ESLG.Entity.PayBillingClient'"}

    即可看出原因是:不能在实体类中找到'LastOwe' 的属性。

原文地址:https://www.cnblogs.com/greatandforever/p/1625698.html