Hi,

Could support for standard Nhibernate enumeration mapping be added to
AutoPersistenceModel?

For example mapping a property Direction of type enum WindDirection {}
would produce following output:

<property name="Direction">
        <column name="WindDirection" />
</property>

Example implementation would be:
public class Conventions {
...
public void UseSimpleEnumeration()
{
 ReplaceTypeConvention<EnumerationTypeConvention>(new
SimpleEnumerationTypeConvention());
 RemoveTypeConvention<NullableEnumerationTypeConvention>();
 }

 private void RemoveTypeConvention<TConvention>()
 {
 var convention = _typeConventions.Find(c => c.GetType() == typeof
(TConvention));
 if (convention != null)
  typeConventions.Remove(convention);
}

private void ReplaceTypeConvention<TConvention>(ITypeConvention
replacement)
{
 RemoveTypeConvention<TConvention>();
 AddTypeConvention(replacement);
}
}

 public class SimpleEnumerationTypeConvention : ITypeConvention
    {
        public bool CanHandle(Type type)
        {
            return type.IsEnum;
        }

        public void AlterMap(IProperty propertyMapping)
        {
        }
    }

And Usage:

AutoPersistenceModel
 .WithConvention(convention => convention.UseSimpleEnumeration())





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to