0

有人是否可以将 Fluent NHibernate 配置为使用“具有具体类的表”继承自动映射对象。在查看自动映射(我已写入文件)时,我有许多从 EntityBase 派生的实体,但我希望 Id 列位于每个表上而不是 EntityBase 表上。

<class name="EntityBase" table="EntityBase" xmlns="urn:nhibernate-mapping-2.2">
    <id name="Id" type="Int32" column="EntityBaseID">
      <generator class="identity" />
    </id>
    <joined-subclass name="CategoryType, ..., Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <key column="EntityBaseId" />
      <property name="CategoryTypeGUID">
        <column name="CategoryTypeGUID" />
      </property>
    </joined-subclass>
</class>

我搜索了 Fluent 文档,但看不到与此相关的任何内容。

提前致谢。

4

1 回答 1

0

您是否在自动映射中设置了IsBaseType约定?这个特定的约定定义了在您的代码中被视为简单基类的东西,而不是被视为实体继承层次结构的一部分的东西。

AutoPersistenceModel
  /* regular config */
  .WithSetup(s =>
    s.IsBaseType = (type => type == typeof(EntityBase)));
于 2009-03-27T21:54:24.957 回答