我有一个普通的数据库表(名为 DBFoo):
| PropertyA | PropertyB| PropertyC | PropertyD | PropertyE |
PropertyA、PropertyB 和 PropertyC 是键的一部分。
为此,在我的程序中,我有以下类结构:
public class Foo
{
public virtual SubFoo SubFoo { get; set; }
public virtual string PropertyC { get; set; }
public virtual string PropertyD { get; set; }
public virtual string PropertyE { get; set; }
}
public class SubFoo
{
public virtual string PropertyA { get; set; }
public virtual string PropertyB { get; set; }
}
现在我正在尝试创建映射文件:
...
<class name="Foo" table="DBFoo">
<composite-id>
// here I Need to define the mapping for the SubFoo properties PropertyA and PropertyB
<key-property name="PropertyC" column="PropertyC"/>
</composite-id>
<property name="PropertyD" column="PropertyD"/>
<property name="PropertyE" column="PropertyE"/>
</class>
....
任何人都知道如何定义 PropertyA 和 PropertyB 的键属性?
提前感谢您的帮助