如何在fluent-nhibernate中表示下一个nhibernate xml?
<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>
答案 0 :(得分:0)
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();
});
我建议您查看conventions以指定映射的重复部分,例如大写列和表名。