ObjectState never really took on as large a role I had originally envisioned, while at the same time being quite clunky -- an extra field automatically injected into all model types. It had a single member saved, which tracks whether the object had previously been saved or not. Most of the time this doesn't matter though, especially since #117 changed save to upsert. I believe the only remaining case where it does matter is for automatic creation of primary keys, and those were operating in a semantic grey area where creating an unitialized primary key required setting it to -1 or similar.
This change does the following
Removes ObjectState and the auto-created state member for each model
Adds a new AutoPk<T> type which is used as the type for fields which represent automatic primary keys. This tracks whether the primary key has already been generated or not.
ObjectState never really took on as large a role I had originally envisioned, while at the same time being quite clunky -- an extra field automatically injected into all model types. It had a single member
saved
, which tracks whether the object had previously been saved or not. Most of the time this doesn't matter though, especially since #117 changed save to upsert. I believe the only remaining case where it does matter is for automatic creation of primary keys, and those were operating in a semantic grey area where creating an unitialized primary key required setting it to-1
or similar.This change does the following
ObjectState
and the auto-createdstate
member for each modelAutoPk<T>
type which is used as the type for fields which represent automatic primary keys. This tracks whether the primary key has already been generated or not.