Hello,
I was just testing a NHibernate one-to-one relation, when I ran into this error.
Code:
Unbehandelte Ausnahme: NHibernate.MappingException: Error reading resource: WindowsApplication1.Person.hbm.xml ---> NHibernate.MappingException: could not find class: WindowsApplication1.Item ---> System.TypeLoadException: Der Typ WindowsApplication1.Item in der Assembly NHibernate, Version=1.0.1.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc konnte nicht geladen werden.
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at NHibernate.Util.ReflectHelper.ClassForName(String name)
   at NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
   --- Ende der internen Ausnahmestapelüberwachung ---
   at NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
...
The only thing i wanted is to use an Classe named 
Item in my Class 
Person. I decided to use a one-to-one relation. and here is how i did it.
For the Person:Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="WindowsApplication1.Person, WindowsApplication1" table="persons">
      <id name="Id" column="userid" type="Int32">
         <generator class="native" />
      </id>
      <property name="Firstname" column="firstname" type="String(50)" />
      <property name="Lastname" column="lastname" type="String(50)" />
        <one-to-one name="MyItem" class="WindowsApplication1.Item" constrained ="true" />
   </class>
</hibernate-mapping>
Code:
using System;
namespace WindowsApplication1
{
   public class Person
   {
      private Item _myItem;
      private int _id = 0;
      private string _firstname;
      private string _lastname;
      public Person() {}
      
      public int Id{...}
      public Item MyItem{...}
      public string Firstname{...}
      public string Lastname{...}
   }
}
And for the Item:Code:
<?xml version="1.0" encoding="utf-8" ?> 
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="WindowsApplication1.Item, WindowsApplication1" table="item">
      <id name="Id" column="itemid" unsaved-value ="0" type="Int32">
      <generator class="native" />
      </id>
      <property name="Name" column="name" type="String(50)" />      
   </class>
</hibernate-mapping>
Code:
using System;
namespace WindowsApplication1
{
   public class Item
   {
      private string _name;
      private int _id;
      public Item(){}
      public int Id{...}
      public string Name{...}
   }
}
It breaks with the error message at this line:Code:
...
   config.AddClass(typeof(WindowsApplication1.Item));
   config.AddClass(typeof(WindowsApplication1.Person)); // <-- this one fails
...
But why doesn't it find the class?
Thanks, and best regards.
El Gringo