You can use the NHibernate.Type.EnumStringType class to store your enumerations as VARCHAR or CHAR. This is an abstract class which you can easily subclass.
From the SDK docs, if you have the following enum
Code:
public enum MyEnum
{
On,
Off,
Dimmed
}
then you subclass EnumStringType as follows
Code:
public class MyEnumStringType : NHibernate.Type.EnumStringType
{
public MyEnumStringType()
: base( typeof( MyEnum ) )
{
}
}
And use a mapping like
Code:
...
<property name="Status" type="MyEnumStringType, AssemblyContaining" />
...
This will map to a VARCHAR column in the database, and use the enum member names ("On", "Off", "Dimmed" in the example) instead of the numeric values.