Mapping Enumeration of type int in NHibernate

By | August 19, 2008

I wanted to map an integer enumeration type in NHibernate, I googled “mapping enumeration in NHibernate” and the best explanation was of Jeremy Miller in his post here.

But as it appears (and according to my understanding) that the enumeration type should be mapped to a database column of characters type (varchar, char,…etc).
What if the database column was int? well…do exactly like what jeremy did except simply use “NHibernate.Type.PersistentEnumType” instead of “NHibernate.Type.EnumStringType“.

The sole purpose of this post is that I didn’t find this solution fast enough on google, so I hope it helps others faster.

Leave a Reply

Your email address will not be published. Required fields are marked *