<AutoIncrement> Element

Sets the identity strategy of the enclosing element to use the auto-increment feature of the underlying relational database system.

<PersistentField [fieldName="fieldName"]>

       <AutoIncrement [value="enabled"]>

</PersistentField>

or

<PersistentField [fieldName="fieldName"]

       [AutoIncrement="enabled"]

/>

enabled: If set to true, the field is initialised with a server-side generated numeric value.

Remarks

·    The mapped property must be of an integer type.

·    This mapping feature can only be applied to read only properties (i.e. can only have a getter).

Examples

           

<Type name="AutoIncrementedSample">

  …

  <PrimaryKey>

    <Key>Id</Key>

  </PrimaryKey>

  <Member name="Id"><PersistentField AutoIncrement="true"/></Member>

  …

</Type>

Requirements

Editions:Professional, Evaluation, Express

Database Platforms:Microsoft SQL Server 2000, Microsoft SQL Server 2005, IBM DB2

See Also

<PersistentField> Element | Object Identity Generation Strategies



Object Identity Generation Strategies <Sequence> Element