Reputation: 41442
Edit: Ryan raised a good point. I specifically want to be able to map to and from while still storing human-readable values in the database. That is, I don't want a bunch of enumeration integers in my database.
Upvotes: 1
Views: 2701
Reputation: 7846
I think you can just set the type to string:
<property name="EnumProperty" Type="string" Length="50" NotNull="true" />
Upvotes: 0
Reputation: 846
According to the documentation you can either leave the type attribute of the property in your mapping file blank or you define it and specify the class name of the enumeration.
Another way would be to convert the enumeration to an int and use the int as the mapped type.
Upvotes: 5
Reputation: 9928
I've never used NHibernate, but can't you just set the SQL datatype to int?
Upvotes: 0