Emad Al-Ashi’s Blog

August 19, 2008

Mapping Enumeration of type int in NHibernate

Filed under: Development, NHibernate — Tags: , , , , — eashi @ 10:45 am

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.

1 Comment »

  1. louiseslittleladies.Com

    Mapping Enumeration of type int in NHibernate | Emad Al-Ashi’s Blog

    Trackback by louiseslittleladies.Com — July 25, 2022 @ 12:08 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.