我試圖根據本教程安裝nhibernate,但它沒有說我應該在哪裏放置Cat.hbm.xml文件以及項目應該如何理解它的項目部分。我應該在哪裏放NHibernate hibernate-mapping xml文件?
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="QuickStart" assembly="QuickStart">
<class name="Cat" table="Cat">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by NHibernate with the UUID pattern. -->
<id name="Id">
<column name="CatId" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="16" not-null="true" />
</property>
<property name="Sex" />
<property name="Weight" />
</class>
</hibernate-mapping>
https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/pdf/nhibernate_reference.pdf
或者,使用Fluent NH,您可以在內存中生成映射/將它們傳輸到會話工廠... – dotjoe 2011-05-06 13:48:06