如何将这个字典映射到最新的 FluentNHibernate 版本?

发布于 12-05 02:51 字数 1879 浏览 1 评论 0原文

我还有一个问题。我升级到 FluentNHibernate 现在得到了 我的字典映射有问题。

我尝试映射的类具有以下属性

IDictionary LohnParameter

映射如下

HasMany(x => x.LohnParameter) 
     .ForeignKey("cat_condition_version__id") 
     .DictionaryKey("wrd_cntry__id") 
     .OneToMany<boLohnartEigenschaften>() 
     .Not.Lazy() 
     .Inverse() 
     .Cascade.AllDeleteOrphan();

生成的 hbm.xml 如下所示:

<map cascade="all-delete-orphan" inverse="true" lazy="false" name="LohnParameter" table="boLohnartVersionLohnParameter" mutable="true">
        <key>
          <column name="cat_condition_version__id" />
        </key>
        <index-many-to-many class="proSoft.Office.Model.Business.Welt.boLand, proSoft.Office.Model.Business, Version=0.1.19.20243, Culture=neutral, PublicKeyToken=b0e4f89242e69335">
          <column name="wrd_cntry__id" />
        </index-many-to-many>
        <one-to-many class="proSoft.Office.Model.Business.Konditionen.boLohnartEigenschaften, proSoft.Office.Model.Business, Version=0.1.19.20243, Culture=neutral, PublicKeyToken=b0e4f89242e69335" />
      </map>

在新版本中,编译器抱怨该属性 “外键”丢失。我现在尝试了一切,但我无法做到 正常工作。我的最后一次尝试是:

  HasMany(x => x.LohnParameter) 
     .AsMap<boCountry>( 
       index => index.Column("wrd_cntry__id").Type<boCountry>(), 
       element => element.Type<boLohnartEigenschaften>() 
     ) 
     .KeyColumn("cat_condition_version__id") 
     .Not.LazyLoad() 
     .Inverse() 
     .Cascade.AllDeleteOrphan();

但我总是得到的错误是:

{“无法确定以下类型: proSoft.Office.Model.Business.Welt.boCountry, proSoft.Office.Model.Business,版本=0.1.14.556,文化=中性, PublicKeyToken=b0e4f89242e69335,对于列: NHibernate.Mapping.Column(wrd_cntry__id)"}

我不知道该做什么。

问候

Christian Erhardt

i've got one more question. I upgraded to FluentNHibernate and got now a
problem with my dicitionary mappings.

The class i'am trying to map has the following Property

IDictionary LohnParameter

The mapping is as follows

HasMany(x => x.LohnParameter) 
     .ForeignKey("cat_condition_version__id") 
     .DictionaryKey("wrd_cntry__id") 
     .OneToMany<boLohnartEigenschaften>() 
     .Not.Lazy() 
     .Inverse() 
     .Cascade.AllDeleteOrphan();

The resulting hbm.xml looks like this:

<map cascade="all-delete-orphan" inverse="true" lazy="false" name="LohnParameter" table="boLohnartVersionLohnParameter" mutable="true">
        <key>
          <column name="cat_condition_version__id" />
        </key>
        <index-many-to-many class="proSoft.Office.Model.Business.Welt.boLand, proSoft.Office.Model.Business, Version=0.1.19.20243, Culture=neutral, PublicKeyToken=b0e4f89242e69335">
          <column name="wrd_cntry__id" />
        </index-many-to-many>
        <one-to-many class="proSoft.Office.Model.Business.Konditionen.boLohnartEigenschaften, proSoft.Office.Model.Business, Version=0.1.19.20243, Culture=neutral, PublicKeyToken=b0e4f89242e69335" />
      </map>

With the new version, the compiler complains, that the Property
"ForeignKey" is missing. I tried now everything, but i can't get it to
work properly. My last try was:

  HasMany(x => x.LohnParameter) 
     .AsMap<boCountry>( 
       index => index.Column("wrd_cntry__id").Type<boCountry>(), 
       element => element.Type<boLohnartEigenschaften>() 
     ) 
     .KeyColumn("cat_condition_version__id") 
     .Not.LazyLoad() 
     .Inverse() 
     .Cascade.AllDeleteOrphan();

But the error i always get is:

{"Could not determine type for:
proSoft.Office.Model.Business.Welt.boCountry,
proSoft.Office.Model.Business, Version=0.1.14.556, Culture=neutral,
PublicKeyToken=b0e4f89242e69335, for columns:
NHibernate.Mapping.Column(wrd_cntry__id)"}

I don't have clue what do do.

Regards

Christian Erhardt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深海里的那抹蓝2024-12-12 02:51:13

我想你正在寻找这个

HasMany(x => x.LohnParameter) 
    .AsEntityMap("wrd_cntry__id")

i think you searching for this

HasMany(x => x.LohnParameter) 
    .AsEntityMap("wrd_cntry__id")
愁以何悠2024-12-12 02:51:13

谢谢你的提示,这是正确的方法。正确的映射是这样的:

     HasMany(x => x.LohnParameter)
        .KeyColumn("cat_condition_version__id")
        .AsEntityMap("wrd_cntry__id")         
        .Not.LazyLoad()
        .Inverse()
        .Cascade.AllDeleteOrphan();

这会产生完全相同的 hbm.xml 文件。

谢谢你!

Thank you for the hint, it was the right way. The correct mapping is this:

     HasMany(x => x.LohnParameter)
        .KeyColumn("cat_condition_version__id")
        .AsEntityMap("wrd_cntry__id")         
        .Not.LazyLoad()
        .Inverse()
        .Cascade.AllDeleteOrphan();

This results in exact the same hbm.xml file.

Thank you!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文