Why are enums mapped as strings and not as ints when using automapper in Fluent NHibernate?
A:
thanks to Mikael Henriksson at the fluent-nhibernate mailing list i found the answer:
public class EnumConvention :
IPropertyConvention,
IPropertyConventionAcceptance
{
#region IPropertyConvention Members
public void Apply(IPropertyInstance instance)
{
instance.CustomType(instance.Property.PropertyType);
}
#endregion
#region IPropertyConventionAcceptance Members
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect(x => x.Property.PropertyType.IsEnum);
}
#endregion
}
Carl Hörberg
2009-12-02 06:11:57