Object Identity Generation Strategies

Genome supports client-side and server-side object identity generation.

In the case of client-side object identity generation, the constructor of the class generates and sets the persistent properties that determine the object's identity. The <NewGuid/> mapping can also be used for setting Guid values on the client side.

With server-side object identity generation, the database server initialises the primary key fields of tables that store object instances. Genome uses temporary identity values for newly created objects until it receives the final values from the database system. Genome also sets NearObjectReference values (foreign key values) that point to newly created objects when the object identity values have been generated by the database server. Server-side initialised fields must be declared as read only (i.e can only have a getter).

Different database platforms provide individual mechanisms for initialising primary key values, which can be configured using database-specific mapping features such as <AutoIncrement> element, <Sequence> element and <SequentialGuid> element. Also, the <DefaultValue> element can be used to provide primary key value initialisation with other database default values.

The <NativeIdGenerator> element transparently uses the appropriate mechanism for the selected target platform that Genome is compiling for.

See Also

<PersistentField> Element | <NativeIdGenerator> Element | <AutoIncrement> Element | <Sequence> Element | <NewGuid> Element | <SequentialGuid> Element | <DefaultValue> Element

<AutoIncrement> Element