问题描述
问题确实如此,默认是映射为 更新 字符串
,但我需要它映射为 int $我现在使用
PersistenceModel
来设置我的约定,如果这有什么区别的话。提前致谢。
发现从中继获取最新版本的代码解决了我的问题。
<$公共类接受(IAcceptanceCriteria< IPropertyInspector>标准)
{
criteria.Expect(x =>> ; x.Property.PropertyType.IsEnum);
}
public void Apply(IPropertyInstance target)
{
target.CustomType(target.Property.PropertyType);
}
}
Question says it all really, the default is for it to map as a string
but I need it to map as an int
.
I'm currently using PersistenceModel
for setting my conventions if that makes any difference. Thanks in advance.
UpdateFound that getting onto the latest version of the code from the trunk resolved my woes.
The way to define this convention changed sometimes ago, it's now :
public class EnumConvention : IUserTypeConvention
{
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect(x => x.Property.PropertyType.IsEnum);
}
public void Apply(IPropertyInstance target)
{
target.CustomType(target.Property.PropertyType);
}
}
这篇关于你如何将一个枚举映射为一个int值与流利的NHibernate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!