13

Is it possible to map an enum as a string using Fluent Nhibernate?

Chris Conway
  • 16,269
  • 23
  • 96
  • 113

2 Answers2

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
2

and there is also the EnumString class you can pass as customType

Jan
  • 6,532
  • 9
  • 37
  • 48