当前位置:编程学习 > C#/ASP.NET >>

NHibernate Could not configure datastore from file

mCfg.AddXmlFile(System.Web.HttpContext.Current.Server.MapPath("Userhbm.xml"));

//Userhbm.xml


<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
                   xmlns="urn:nhibernate-mapping-2.2" 
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    namespace="WebNhibernate" assembly="WebNhibernate">

  <class name="WebNhibernate.EntityClass,WebNhibernate" table="users">

    <id name="Id" column="LogonId" type="String" length="20">

      <generator class="assigned" />

    </id>

    <property name="UserName" column= "Name" type="string" length="40"/>

    <property name="Password" type="string" length="20"/>

    <property name="EmailAddress" type="String" length="40"/>

  </class>

</hibernate-mapping>


补充:
刚刚接触NHibernate,不知道实体类和xml映射放在什么目录位置??
--------------------编程问答-------------------- --------------------编程问答-------------------- 关注ing…… --------------------编程问答-------------------- 添加的路径应该是相对全路径,如:如果HBM文件在工程的TEST目录下面,那么ADDXMLFILE方法的参数应该是“test\\...hbm.xml”
补充:.NET技术 ,  .NET技术前瞻
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,