The OpenAccess ORM Runtime system manages the identity in case of Internal Identity. All that the user needs to do is to make an object persistent and to add it to an IObjectScope instance; therefore this is the easiest to implement.
It’s the simplest to implement and should be used in cases where the user does not want to do anything to implement object identity. The generated identity is of the integer type and it is a hidden field. It should be used in cases where the application does not use the identity value directly.
The Internal Identity field has an integer type and can be calculated by an OpenAccess ORM High-Low key generator or by the database from an AutoInc column without any application code.
Specifying Internal Identity
Internal Identity is the default identity type used by OpenAccess. For classes using internal identity, a column of type SQL INTEGER or SQL VARCHAR is automatically generated (refer to Inheritance for further information). Generally this column is named tablename_id and it is possible to change the name of this _id column to a name of your choice, manually, by adding the following entries to the App.config file:
<extension key="db-column-name" value="name_that_you_want" />
Changing the name of the _id column is unfortunately not possible using the metadata properties dialog, therefore, you need to manually alter the App.config file as shown above.
You can also change the type and other properties of the primary key column by editing the XML metadata. The following example uses the db-primary-key (see db-primary-key) and db-column (see db-column) extensions to change the type of the column to SMALLINT:
<extension key="db-type" value="SMALLINT" />
Use the Metadata Properties dialog to specify the Internal Identity as shown below:
Internal should be chosen as the identity type from the drop-down list present alongside the Type label. Next, chose the type of key generator needed from a drop-down list present alongside the Key Generator label , HIGHLOW is the default key generator, the AUTOINC key generator can also be chosen (refer to db-key-generator for more information).
A key generator provides the primary key values (refer to db-key-generator for more information). A key generator, generates identity field values automatically. Internal Identity currently supports key generation using a lookup table (the HIGHLOW or sequence block algorithm) and using identity or auto increment columns (AUTOINC key generator). The HIGHLOW key generator is the default, and it uses a last_used table to generate the id for a new instance. The AUTOINC key generator relies on the database to provide an id value for a new instance.