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技术前瞻