We had to deal with this at work recently.
We use FluentNhibernate, and for this we have created an agreement:
public class EnumConvention : IPropertyConvention, IConventionAcceptance<IPropertyInspector>
{
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect(x => x.Property.PropertyType.IsEnum);
}
public void Apply(IPropertyInstance instance)
{
instance.CustomType(instance.Property.PropertyType);
}
}
Then you can simply match your property
Map(x => x.Enum);
This is an integer in the database
source
share