Only One Reason to ever use Transient Properties in Core Data
Only One Reason to ever use Transient Properties in Core Data
- Subject: Only One Reason to ever use Transient Properties in Core Data
- From: Jerry Krinock <email@hidden>
- Date: Tue, 19 May 2009 20:20:49 -0700
After working through another issue caused by my use of a transient
property, I just searched the whole Core Data Programming Guide for
"transient".
I found four disadvantages of using transient properties vs. one
advantage. The advantage is not having to write custom accessor
methods to support non-standard data types.
So my conclusion is that it is a design mistake to make "Transient" an
attribute which is of a standard data type. You get no advantages --
only headaches, possible bugs, and "gotchas" when you switch from XML
to SQLite store.
Have I missed anything?
Jerry Krinock
(*) Here are the four disadvantages:
... you cannot fetch using a predicate based on transient properties...
... you cannot sort on transient properties using the SQLite store...
... with transformable attributes you specify just one attribute and
the conversion is handled automatically. In contrast, with transient
properties you specify two attributes and
you have to write code to perform the conversion.
... If you use refreshObject:mergeChanges: with the mergeChanges flag
YES, then any transient properties are restored to their pre-refresh
value after awakeFromFetch is invoked. This means that, if you have a
transient property with a value that depends on a property that is
refreshed, the transient value may become out of sync.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden