How to represent next nhiber开发者_运维技巧nate xml in fluent-nhibernate?
<set name="Items" lazy="true" table="CATEGORY_ITEMS">
<key column="CATEGORY_ID"/>
<composite-element class="CategorizedItem">
<parent name="Category"/>
<many-to-one name="Item"
class="Item"
column="ITEM_ID"
not-null="true"/>
<property name="Username" column="USERNAME" not-null="true"/>
<property name="DateAdded" column="DATE_ADDED" not-null="true"/>
</composite-element>
</set>
HasMany(x => x.Items)
.Table("CATEGORY_ITEMS")
.Component(com =>
{
com.ParentReference(x => x.Category);
com.References(x => x.Item)
.Not.Nullable();
com.Map(x => x.Username)
.Not.Nullable();
com.Map(x => x.DateAdded)
.Not.Nullable();
});
I encourage you to look into conventions for specifying the repetitious parts of your mappings, like the uppercase column and table names.
精彩评论