NH has its own Generic Enum Mapper BTW On Mon, Dec 15, 2008 at 8:33 PM, Derick Bailey <der...@derickbailey.com>wrote:
> > in NHibernate, the default mapping of an Enum is to an integer (at > least, I've never told it to do anything special, and it has always > mapped to my integer columns fine). In FluentNHibernate, the default > mapping is to a string, because of the GenericEnumMapper class: > > namespace FluentNHibernate.Mapping > { > public class GenericEnumMapper<TEnum> : EnumStringType > { > public GenericEnumMapper() > : base(typeof (TEnum)) > { > } > } > } > > the problem is the "EnumStringType" that's being inherited from. > > I don't want to map enums to strings. I want to map them to integers, > because I use the enum integer value as a primary key in a relational > table, for data consistency and reporting purposes. > > How do I tell FluentNHibernate to not map the enum as a string, but > map as an int? There is no "EnumIntType" to create a different enum > mapper, and when i pass in an empty string for the .CustomType of my > property, it throws an exception. > > > -- Tuna Toksöz http://tunatoksoz.com Typos included to enhance the readers attention! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---