代码改变世界

请教NHibernate 总出现Could not compile the mapping document [问题已搞定]

2008-05-21 22:46  Santos  阅读(7919)  评论(14编辑  收藏  举报

 

解决办法通一个朋友了解到,错误是在配置文件里.
NHibernate 版本:1.2

配置文件写法:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System,
                    Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>

  <nhibernate>
    <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
    <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
    <add key="hibernate.connection.connection_string" value="Server=.;initial catalog=NHibernate;uid=sa;pwd=sa;Integrated Security=SSPI" />
    <add key="hibernate.connection.isolation" value="ReadCommitted"/>
    <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
  </nhibernate>
</configuration>



运行通过,搞定。。。



不明白原因,请指教
MSN:foxrain59@hotmail.com

实体类
Person.cs

 

using System;
using System.Collections;

namespace Test.Model
{
    
Person
}
Person.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
    
<class name="Test.Model.Person, Test.Model" table="Person">
        
<id name="Id" type="Int32" unsaved-value="null">
            
<column name="id" length="4" sql-type="int" not-null="true" unique="true" index="PK_Person"/>
            
<generator class="native" />
        
</id>
        
<property name="Name" type="String">
            
<column name="name" length="50" sql-type="varchar" not-null="true"/>
        
</property>
    
</class>
</hibernate-mapping>