Reputation: 150263
I have a class that has an enum that it's values are ASCII codes. I want to save in the DB the char value not the ASCII code, How can I achieve that?
Upvotes: 1
Views: 998
Reputation: 31454
You can implement your own type conversion using IUserType interface. Example how to do that can be found here or here.
IUserType
Once you do that, you have to tell your fluent mapper to use this type for given property:
Map(u => u.AsciiCode).CustomType<AsciiCodeAsChar>();
Upvotes: 2