如何映射这个词典与最新的流利的NHibernate版本? [英] How to map this Dictionary with the newest fluentNHibernate version?

查看:110
本文介绍了如何映射这个词典与最新的流利的NHibernate版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还有一个问题。我升级到FluentNHibernate,并得到了我的dicitionary映射
问题。

我试图映射的类有以下属性
$ b $ 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-orphaninverse =truelazy =falsename =LohnParametertable =boLohnartVersionLohnParametermutable =true> ; 
< key>
< column name =cat_condition_version__id/>
< / key>
< column name =wrd_cntry__id/>
< / index-many-to-many>
;
< / map>

对于新版本,编译器会抱怨Property
ForeignKey缺失。我现在试了一切,但我不能让它
正常工作。我最后一次尝试是:

$ p $ HasMany(x => x.LohnParameter)
.AsMap< boCountry>(
index => index.Column(wrd_cntry__id)。类型< 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,Version = 0.1.14.556,Culture = neutral,
PublicKeyToken = b0e4f89242e69335,列:
NHibernate.Mapping.Column(wrd_cntry__id)}



我不知道该怎么做。

问候

Christian Erhardt

解决方案

我想你在寻找这个

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


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

解决方案

i think you searching for this

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

这篇关于如何映射这个词典与最新的流利的NHibernate版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆