tags:

views:

37

answers:

2

I have trying to install nhibernate according this tutorial, but it doesn't say where I should place Cat.hbm.xml file and how project should understand its part of project.

<?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%5Fdocs/nhibernate/1.2/reference/en/pdf/nhibernate%5Freference.pdf

+4  A: 

Create a folder Resources or Mappings in the project. Put all the mapping file into that folder and store those in assemblies by adding them in the project as “Build Action=Embedded Resource”

Thillakan
A: 

While not directly answereing your question have a look at Stephen Bohlen's Summer of NHibernate series and the Autumn Of Agile Series which I personally found very usefull tools for learning nhibernate.

Nathan Fisher