NHibernate使用问题

守破之间 2007-04-06 11:24:26
各位,本人初尝NHibernate,按照文档例子作一测试。
代码执行
Configuration config = new Configuration().AddAssembly("Test.Model")处抛出异常,异常描述为“Could not add assembly Test.Model”
====================================
本人的应用配置文件:
<?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=localhost;Initial Catalog=NHibernate;Integrated Security=SSPI" />

<!--
<add key="hibernate.connection.connection_string" value="Server=localhost;Initial Catalog=NHibernate;user id = sa; password = xxx;" />
-->
<add key="hibernate.connection.isolation" value="ReadCommitted"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
</nhibernate>

</configuration>

======================================================
本人的映射关系文件
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<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>
=========================================================
请教大家这是怎么回事?怎么解决?
...全文
299 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
守破之间 2007-04-06
  • 打赏
  • 举报
回复
本人将Configuration config = new Configuration().AddAssembly("Test.Model")变为 Configuration config = new Configuration().AddAssembly( "Model")后,异常转为:
Could not compile the mapping document: Test.Model.Person.hbm.xml
dinoLgrace 2007-04-06
  • 打赏
  • 举报
回复
呵呵,毕业设计时做过,现在忘了,你在csdn的asp.net小类里面搜索下nhibernate应该能查到很多相关内容的!
守破之间 2007-04-06
  • 打赏
  • 举报
回复
另外本人的Person.hbm.xml文件已经被改为内嵌资源
ylqmf 2007-04-06
  • 打赏
  • 举报
回复
up
windylau23 2007-04-06
  • 打赏
  • 举报
回复
up

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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