Saturday, February 19, 2011

NHibernate SchemaExport with generated properties

I'm wondering if there is a way to get SchemaExport to generate and identity column for a generated property.

<id name="Id" column="Id" type="Guid">
  <generator class="guid.comb" />
</id>
<property name="OrderNumber" column="OrderNumber" type="Int32" generated="insert"/>

With the mapping above, ShcemaExport does not make the OrderNumber column an Identity column.

Greg

From stackoverflow
  • I figured it out, with Fabio Maulo's help:

    <property name="OrderNumber" generated="insert" update="false">
      <column name ="OrderNumber" sql-type="int identity" not-null="true"/>
    </property>
    

0 comments:

Post a Comment