gdoron
gdoron

Reputation: 150263

FluentNhibernate: map byte enum as char

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

Answers (1)

k.m
k.m

Reputation: 31454

You can implement your own type conversion using IUserType interface. Example how to do that can be found here or here.

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

Related Questions