How do you map an enum as string in fluent nhibern

2019-01-18 22:40发布

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

2条回答
Animai°情兽
2楼-- · 2019-01-18 23:17

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

查看更多
聊天终结者
3楼-- · 2019-01-18 23:22

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>>();
查看更多
登录 后发表回答