IsEnum never true in conventions

cremor's Avatar

cremor

26 Jul, 2010 06:22 AM via web

I want to create a convention for all enums in my project. I tried the following but it doesn't work:

ConventionBuilder.Property.When(
   c => c.Expect(x => x.Type.IsEnum),
   x => x.CustomSqlType("text"))

I think this is because x.Type's inner type isn't my enum but GenericEnumMapper<MyEnum>. But it needs to be directly an enum, otherwise innerType.IsEnum doesn't return true.

Is this a bug in FluentNHibernate or is there another way?

  1. Support Staff 2 Posted by Paul Batum on 07 Aug, 2010 12:12 PM

    Paul Batum's Avatar

    I've implemented a fix for this. IsEnum will now return true in the
    scenario you've described.

    The fix should be in the trunk before too long, but until then you can
    use GetUnderlyingSystemType() to get and the inner type and check it
    as necessary.

  2. 3 Posted by cremor on 24 Aug, 2010 06:33 AM

    cremor's Avatar

    Works, thanks.

  3. cremor closed this discussion on 24 Aug, 2010 06:33 AM.

Comments are currently closed for this discussion. You can start a new one.