你如何将一个枚举映射为流利的nhibernate中的字符串? [英] How do you map an enum as string in fluent nhibernate?
本文介绍了你如何将一个枚举映射为流利的nhibernate中的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能使用Fluent Nhibernate将枚举映射为字符串?
你只需要: Map(x => x.YourProperty);
请确保您使用的是最新的版本。
正如 Yavor Shahpasov 所指出的注意,在更新的版本中,您可以完成相同的操作:
Map(x => x.Property).CustomType< ; GenericEnumMapper< YourPropertyEnumType>>();
Is it possible to map an enum as a string using Fluent Nhibernate?
解决方案
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>>();
这篇关于你如何将一个枚举映射为流利的nhibernate中的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文