Hi Guys,
I've also been going through the quickstart and have encountered similar problems, mainly around AddAssembly(). In the quickstart guide, there's basically only one project with the User.cs and the User.hbm.xml in the project (not as references).
I've created a project called TestNHibernate. My User.hbm.xml file is :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHibernate.Examples.QuickStart.User, TestNHibernate" table="users">
<id name="Id" column="LogonId" type="String" length="20">
<generator class="assigned" />
</id>
<property name="UserName" column="Name" type="String" length="40"/>
<property name="Password" type="String" length="20"/>
<property name="EmailAddress" type="String" length="40"/>
<property name="LastLogon" type="DateTime"/>
</class>
</hibernate-mapping>
the user.cs is defined in the namespace (NHibernate.Examples.QuickStart). Now, in the code, if i do the line
Code:
cfg.AddAssembly("TestNHibernate");
(as directed by the quickstart guide), I get NHibernate.MappingExceptionL Unknown entity class: NHibernate.Examples.Quickstart.User.
However, if I replace this line with :
Code:
cfg.AddXmlFile(@"C:\Documents and Settings\waat\My Documents\Visual Studio Projects\TestNHibernate\User.hbm.xml");
It works fine.
I've read through a few of the other posts, I'm guessing that to use AddAssembly, I need to include the dll in my references. however as i'm currently in that project already, doesn't this make a circular reference back to itself? Am I missing something?
Thanks in advance