开发者

Where should I put NHibernate hibernate-mapping xml files?

开发者 https://www.devze.com 2022-12-12 08:10 出处:网络
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.

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" />
&l开发者_如何转开发t;/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


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”


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消