NHIbernate中无法加载映射文件

dangerous_wq 2011-04-27 02:15:29
我的代码如下:
Configuration cfg = new Configuration();//sessionFactory加载正常
cfg.AddXmlFile("Customer.hbm.xml");//就是这句话报错了
sf = cfg.BuildSessionFactory();

我的映射文件 Customer.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="WebApplication1.MODEL" assembly="WebApplication1">
<class name="Customer" table="Customer">
<id name="Id" type="Int32">
<column name="Id" not-null="true"/>
<generator class="native" />
</id>
<property name="Name" column="c_Name" type="string" length="64" not-null="true" unique="true"></property>
<property name="Address" column="c_address" type="string" length="64" not-null="true"></property>
<property name="Sex" column="c_sex" type="Int32" not-null="true"></property>
</class>
</hibernate-mapping>

Vs 中报的错是:Could not compile the mapping document: Customer.hbm.xml。
网页中报的错是:未能找到文件“C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\Customer.hbm.xml”。
...全文
137 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧