I have declareted the fallowing Mapping for NHibernate:
<class name="Sales" table="Sales" lazy="false" >
<id name="Id" column="Id" type="Guid">
<generator class="assigned"/>
</id>
<version name="ObjectVersion" column="ObjectVersion"/>
<property name="Number" column="Subject" type="String" length="255" />
<property name="Text" column="Body" type="String" length="50" not-null="true" />
</class>
I should now add a additional Column called Key which is defined as an AutoIncrement-Column. Can someone give me a tip how I have to declare this column? This Col开发者_运维问答umn has not to be the primary-key - i need only a additional column which has a integer which count up for each record.
Thanks for your help.
Best Regards, Thomas
Are you using SQL Server? If yes, then just create an Identity column ALTER TABLE Sales ADD Key INTEGER Identity(1,1)
Then map it as a normal property. It will not be the primary key but it will auto-increment.
精彩评论