How to map composite-id with fluent nhibernate using an interface?

前端 未结 2 827
鱼传尺愫
鱼传尺愫 2021-01-20 10:32

I\'m trying to switch out .hbm mappings to fluent mappings and have a problem with the mapping of composite-ids and the usage of Interfaces

the Class lo

2条回答
  •  醉酒成梦
    2021-01-20 10:44

    Tanks! But I've found the answer on my on. In fact i found a missing feature in fluent nHibernate. The feature has already been added to the dev branch by Paul Batum.

    You would use it like so:

       Map {
          public ClassWithCompositeIdMap() {
                CompositeId()
                   .KeyReference(x => x.KeyOne, k =>
                       k.Type(), "colkeyone")
                   .KeyReference(x => x.KeyTwo, k =>
                       k.Type(), "colkeytwo");
                 ...
          }
       }
    

    http://github.com/paulbatum/fluent-nhibernate/tree/dev

    You can see the original Conversation here: http://support.fluentnhibernate.org/discussions/help/349-how-to-map-a-composite-id-when-using-interfaces-or-how-to-change-the-class-attribute-in-the-key-many-to-one-tag

提交回复
热议问题