我試圖.hbm
映射切換出流暢的映射,並具有複合id的映射和接口如何使用接口將複合id與流暢的nhibernate進行映射?
使用類看起來如下問題:
public class ClassWithCompositeId {
public virtual IKeyOne KeyOne { get; set; }
public virtual IKeyTwo KeyTwo { get; set; }
}
我們HBM映射看起來像這樣:
<hibernate-mapping ...>
<class name="ClassWithCompositeId" table="t_classwithcompositeid">
<composite-id>
<key-many-to-one name="KeyOne" column="colkeyone" class="company.namespace.boSkillBase, BL_Stammdaten" />
<key-many-to-one name="KeyTwo" column="colkeytwo" class="boQualifikation" />
</composite-id>
</hibernate-mapping>
請注意,我們有類中的接口!不,我試圖用Fluent nhibernate來映射它。
Map {
public ClassWithCompositeIdMap() {
CompositeId()
.KeyReference(x => x.KeyOne, "colkeyone")
.KeyReference(x => x.KeyTwo, "colkeytwo");
...
}
}
但現在流利生成映射如下:
...
<composite-id mapped="false" unsaved-value="undefined">
<key-many-to-one name="KeyOne" class="company.namespace.IKeyOne, Interfaces, Version=0.1.4.3379, Culture=neutral, PublicKeyToken=null">
<column name="colkeyone" />
</key-many-to-one>
<key-many-to-one name="KeyTwo" class="company.namespace.IKeyTwo, Interfaces, Version=0.1.4.3379, Culture=neutral, PublicKeyToken=null">
<column name="colkeytwo" />
</key-many-to-one>
</composite-id>
...
「類」現在屬性指向接口不是本接口,這導致錯誤的執行。
我該如何告訴Fluent nHibernate使用另一個類作爲屬性值?
對不起,類boQualifikation和boSkill應IKeyOne和IKeyTwo實施 – MoJo2600 2010-10-22 13:15:28