I'm trying to switch out .hbm
mappings to fluent mappings and have a problem with the mapping of composite-ids and the usage of Interfaces
the Class looks as follows:
public class ClassWithCompositeId {
public virtual IKeyOne KeyOne { get; set; }
public virtual IKeyTwo KeyTwo { get; set; }
}
our hbm mapping looks like this:
<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>
Please note, that we got interfaces in the Class! No I'm trying to map this with Fluent nhibernate.
Map {
public ClassWithCompositeIdMap() {
CompositeId()
.KeyReference(x => x.KeyOne, "colkeyone")
.KeyReference(x => x.KeyTwo, "colkeytwo");
...
}
}
But now Fluent generates the Mapping as follows:
...
<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>
...
The "Class" Attribute points now to the Interface not to the implementation of this interface which results in an error.
How can I tell Fluent nHibernate to use another class as the attribute value?