使用Nibernate遇到的一个错误 Could not compile the mapping document: eDirectory.Domain.Mappings.Customer.hbm.xml

由于代码和配置文件同时配置了 assembly 导致了这个错误。

  if (string.IsNullOrEmpty(ConfigurationFileName)) throw new ArgumentException("ConfigurationFileName property was blank");
                NhConfigurationInstance = new Configuration();
                NhConfigurationInstance.Configure(ConfigurationFileName);
                NhConfigurationInstance.AddAssembly(typeof(Customer).Assembly);
                return NhConfigurationInstance;
 

而配置文件则如下:

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
  <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
  <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
  <property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
  <property name="connection.connection_string">User ID=scott;Password=123456;Data Source=fortest</property>

  <property name="show_sql">false</property>
  <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
  <property name="hbm2ddl.keywords">none</property>
  <property name="cache.use_second_level_cache">true</property>
  <property name="cache.use_query_cache" >true</property>
  <property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider</property>
  <mapping assembly="eDirectory.Domain"/>
</session-factory>
</hibernate-configuration>

解决办法:删除<mapping  assembly="mapping assembly="eDirectory.Domain"/> 或者注释掉代码中的配置

使用Nibernate遇到的一个错误 Could not compile the mapping document: eDirectory.Domain.Mappings.Customer.hbm.xml,布布扣,bubuko.com

使用Nibernate遇到的一个错误 Could not compile the mapping document: eDirectory.Domain.Mappings.Customer.hbm.xml

上一篇:(已解决)#warning:尚未配置[微信]URL Scheme:wx4868b35061f87884, 无法使用进行授权。


下一篇:Xamarin Mono Android Ios 安装、破解(4.12)