• Fluent NHibernate HasMany PropertyRef solution

    For a long time tried to find the solution for HasMany relationship not through ID property of the entity .
    Starting from Fluent NHibernate build 164 there is a way , no patches included -
    HasMany(x => x.Collection_TChild).AsBag()
    .KeyColumn("CHILDPROPERTY_TOJOINBY")
    .PropertyRef("Parent_Property");

    p.s.
    Crazy thing , after including the FNH.dll of 164 version , we were compelled to add
    column property to the Mapping . So , it means that we went through all our mappings
    and added

    Map(x => x.Property).Column("PropertyNameAsItAppearsInOracleDataBase");

    otherwise the NHibernate didn't recognized the mappings...

0 comments:

Leave a Reply

Thanks for sharing your feedback! If your feedback doesn't appear right away, please be patient as it may take a few minutes to publish - or longer if the blogger is moderating comments.