KeyColumnReturnBehavior

A enumeration that defines the type of conversion to be used when extracting a data from/to the database.

This enum is used to define how the push operations (i.e.: Insert, Merge) behaves when returning the value from the column columns (i.e.: Primary and Identity).

Enum Values

Below is the list of enum values.

Name Description
Primary Returns the value of the primary column.
Identity Returns the value of the identity column.
PrimaryOrElseIdentity Returns the coalesced value of the primary and identity columns. This is the default value.
IdentityOrElsePrimary Returns the coalesced value of the identity and primary columns.

Return Behavior

Below is the actual column value being returned by the push operations, based on the table’s column composition, per enum value.

Has Primary Key Has Identity Key Primary Identity PrimaryOrElseIdentity IdentityOrElsePrimary
✅ ✅ Primary Identity Primary Identity
✅ ❌ Primary None Primary Primary
❌ ✅ None Identity Identity Identity
❌ ❌ None None None None

A value of None means no value is returned (the targeted column does not exist on the table), even though the push operation itself still succeeds.

This enumeration also controls which property is hydrated back onto each model after an InsertAll or MergeAll call. The column resolved in the table above is matched against the entity’s properties, and only the property mapped to that specific column is set; it is not “the primary key property” or “the identity property” as a role.

In the common case where the primary key and identity are the same physical column, there is only one mapped property either way, so the distinction is not observable. But if the identity column is not the designated primary key (e.g., a surrogate identity column alongside a separate business-key primary column), Identity only writes back the property mapped to the identity column — the primary key property is left untouched, retaining whatever value the caller supplied (or its default).