FCModel
FCModel copied to clipboard
"FCModel 2" non-unique-instances branch
Just pushed the first commit e0f9b3d3 of what might be called "FCModel 2" to the "non-unique-instances" branch. This is a big, likely-breaking change that applies a lot of lessons learned since the original design:
Instances are no longer tracked or kept unique in memory. All instances are "detached".
- You can have two instances in memory of the same logical model (same table and primary key).
- Changes made to a model object or table won't affect any other copies in memory.
- If you want your interface to react to changes, you must reload any data in response to FCModel's change notifications.
-
dataWasUpdatedExternally
, reloads, and conflict resolution are no longer necessary and have been removed. -
allLoadedInstances
is no longer possible and has been removed. - Transactions are now supported, although limited. (Rollbacks don't revert changed models in memory.)
- Autoincrement, formerly deprecated, is now removed and will raise an exception.
All saves and deletes are expected to succeed. Saves shouldn't unexpectedly fail or be blocked.
- Removed
should/didInsert/Update/Delete
,saveWasRefused
,saveDidFail
. To customize behavior, overridesave
and call[super save]
from the subclass. -
FCModelSaveResult
is removed.delete
now returns void andsave
now returns a BOOL to indicate whether changes were made. - Saves and deletes that fail from database errors now raise exceptions.
lastSQLiteError
is removed. - All FCModel exceptions now have name
FCModelException
. -
saveAll
has been removed. Saves should happen intentionally, right after you change the data. - Custom serializations for
NSURL
,NSDate
, etc. have been removed to avoid a lot of subtle bugs and inconsistencies between formats.
Notifications have been simplified to just a single FCModelChangeNotification for any change to a table.
-
FCModelInstanceSetKey
has been replaced byFCModelInstanceKey
and will always be one instance if known, or unset for many/unknown. - Notification-batching functions are now redundant and have been removed since transactions also batch notifications.
Take a look and see what you think so far. What other changes should we consider now that we're breaking things?
PLEASE don't ship any apps with this yet.