Ok, I think I figured it out with the help of Reflector.
Pull your assembly into reflector and you will see that your enum, because it's inside of the class, is qualified with a +
Here is my code. I apologize that it's in C# and not VB.NET, but I don't see why it wouldn't resolve the same for you:
Code:
namespace PersonRage
{
public partial class Person
{
public enum PersonStatus
{
Alive,
NotAlive
}
private int id;
private string name;
private PersonStatus status;
public int Id
{
get { return id; }
}
public string Name
{
get { return name; }
set { name = value; }
}
public PersonStatus Status
{
get { return status; }
set { status = value; }
}
}
}
And my mapping:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="PersonRage.Person, PersonRage" table="Person">
<id name="Id" type="Int32" access="nosetter.camelcase" >
<column name="personId" not-null="true" unique="true" />
<generator class="native" />
</id>
<property name="Name" column="Name" />
<property name="Status" column="Status" type="PersonRage.Person+PersonStatus, PersonRage" />
</class>
</hibernate-mapping>
Of note, my type is PersonRage.Person+PersonStatus, PersonRage and not PersonRage.Person.PersonStatus, PersonRage as I would have expected. Please note the plus sign between Person and PersonStatus.
My test code, which worked rather well:
Code:
DbSessionContext.Current.OpenSession();
Person bob = new Person();
bob.Name = "Bob Smith";
bob.Status = Person.PersonStatus.Alive;
DbSessionContext.Current.Save(bob);
DbSessionContext.Current.CloseSession();
DbSessionContext.Current.OpenSession();
Person bobAgain = DbSessionContext.Current.Get<Person>(bob.Id);
Console.WriteLine(bobAgain.Status.ToString());
DbSessionContext.Current.CloseSession();