Re: Only One Reason to ever use Transient Properties in Core Data
Re: Only One Reason to ever use Transient Properties in Core Data
- Subject: Re: Only One Reason to ever use Transient Properties in Core Data
- From: Mike Abdullah <email@hidden>
- Date: Wed, 20 May 2009 09:29:26 +0100
I find transient attributes extremely useful sometimes for properties
which you want in the undo stack, but not persisted to disk. For
example data caches, or session-specific UI properties.
Mike.
On 20 May 2009, at 04:20, Jerry Krinock wrote:
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
_______________________________________________
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