Is it possible to map an enum as a string using Fluent Nhibernate?
Asked
Active
Viewed 9,944 times
2 Answers
26
Yes, it does that by default if you just do:
Map(x => x.YourProperty);
Make sure you're using the latest version off the trunk.
As Yavor Shahpasov pointed out in the comments, in more recent versions you can accomplish the same with:
Map(x => x.Property).CustomType<GenericEnumMapper<YourPropertyEnumType>>();

Community
- 1
- 1

Garry Shutler
- 32,260
- 12
- 84
- 119
-
That was much easier than I imagined! – Chris Conway Feb 02 '09 at 14:34
-
4Apparently FluentNHibernate does not do this by default anymore. – Falcon Feb 01 '11 at 10:41
-
6You can do it like this Map(x => x.Property).CustomType
>(); – Yavor Shahpasov Aug 11 '11 at 18:24