Fluent NHibernate 1.1: when multiple column name mappings are used on different classes

后端 未结 1 1256
一个人的身影
一个人的身影 2021-01-24 15:46

Suppose I have this (simplified)

Class Cliente
Id(v => v.numero_cliente, \"numero_cliente\")
HasMany(v => v.Acionamentos).Cascade.All().LazyLoad()

Class

相关标签:
1条回答
  • 2021-01-24 16:25

    With the help steps you provided and some pray I solved it, adding the KeyColumn!

    Id(v => v.numero_cliente, "numero_cliente")
    HasMany(v => v.Acionamentos).KeyColumn("numero_cliente").Cascade.All().LazyLoad()
    

    after adding that, then the generated HBM was changed to:

    <bag cascade="all" lazy="true" name="Acionamentos" mutable="true">
        <key>
            <column name="numero_cliente" /> 
        </key>
        <one-to-many class="Sistema.CRM.Acionamento, Sistema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> 
    </bag>
    

    and no more SQL errors happened.

    I am happy that I will be able to use it now! I really did not want to use EF

    0 讨论(0)
提交回复
热议问题