Enum in composite key gets mapped to int when I need string

Original Post quintinpar's Avatar

quintinpar

21 Mar, 2010 07:03 AM via web

Can someone please answer this question at Stackoverflow

http://stackoverflow.com/questions/2486275/fluent-nhibernate-enum-i...

  1. Support Staff 2 Posted by James Gregory on 23 Mar, 2010 08:55 PM

    James Gregory's Avatar

    Seems like there's a bug here; we should be consistent with the rest of the enum behaviour.

    There's an easy workaround though, if a little funky:

    CompositeId()
      .KeyProperty(x => x.Type, kp => kp.Type(typeof(GenericEnumMapper<AddressType>)));
    

    I've created a ticket for this, so we'll get it fixed to work like the rest of the enum support.

  2. 3 Posted by quintinpar on 24 Mar, 2010 07:09 AM

    quintinpar's Avatar

    The second parameter in KeyProperty accepts a columName. Using
    kp => kp.Type(typeof(GenericEnumMapper<AddressType>)
    did not compile

    The options are
    public CompositeIdentityPart<T> KeyProperty(Expression<Func<T, object>> expression, string columnName) public CompositeIdentityPart<T> KeyReference(Expression<Func<T, object>> expression)

    Am I missing something?

  3. 4 Posted by quintinpar on 24 Mar, 2010 08:37 AM

    quintinpar's Avatar

    The second parameter in KeyProperty accepts a columName. Using
    kp => kp.Type(typeof(GenericEnumMapper<AddressType>)
    did not compile

    The options are
    public CompositeIdentityPart<T> KeyProperty(Expression<Func<T, object>>
    expression, string columnName) public CompositeIdentityPart<T>
    KeyReference(Expression<Func<T, object>> expression)

  4. Support Staff 5 Posted by James Gregory on 24 Mar, 2010 08:54 AM

    James Gregory's Avatar

    You need to update to a newer build of Fluent NHibernate; that particular overload has been available since November.

  5. Support Staff 6 Posted by James Gregory on 01 May, 2010 02:16 PM

    James Gregory's Avatar

    This has been fixed in master.

  6. James Gregory resolved this discussion on 01 May, 2010 02:16 PM.

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

Recent Discussions

05 Jul, 2010 10:29 PM
05 Jul, 2010 12:45 PM
05 Jul, 2010 12:42 PM
05 Jul, 2010 12:17 PM
05 Jul, 2010 12:12 PM

 

03 Jul, 2010 12:26 AM
02 Jul, 2010 02:17 PM
02 Jul, 2010 08:18 AM
02 Jul, 2010 12:20 AM
01 Jul, 2010 10:14 PM