Well, they're not exactly the same, but you can't have a Char Enum. It's stored as an Int32 behind the scenes.
Code:
public enum GarageType
{
CodeA = 'A',
CodeD = 'D',
Unknown = 'U'
}
is my enum, and if I do
Code:
Enum.GetUnderlyingType(typeof(GarageType))
it returns Int32.
In the mapping file, I have
Code:
<property name="GarageType" type="BuyHomes.Core.Types.GarageType, BuyHomes.Core" />
If the database column is a char(1), '*' gets saved in the column, and when I try to pull it out, an exception is thrown in PersistentEnumType.GetValue, because '*' can't be converted to an Int32, which is what it sees the Enum as.
If the database column is an int, the ASCII value of the character gets stored in the database, and everything works fine.
I was just thinking it would be nice to be able to store the character value in the database instead. If I get some time, I may modify the PersistentEnumType to support this.