How do we express this in FNH?
<class name="Order" .... >
....
<set name="PurchasedItems" table="purchase_items" lazy="true">
<key column="order_id">
<composite-element class="Purchase">
<property name="PurchaseDate"/>
<property name="Price"/>
<property name="Quantity"/>
<many-to-one name="Item" class="Item"/> <!-- class开发者_JAVA百科 attribute is optional -->
</composite-element>
</set>
This should do it:
HasMany(x => x.PurchasedItems)
.Component(c =>
{
c.Map(x => x.PurchaseDate);
c.Map(x => x.Price);
c.Map(x => x.Quantity);
c.References(x => x.Item);
});
精彩评论