re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
- Subject: re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
- From: Ben Trumbull <email@hidden>
- Date: Sat, 28 Mar 2009 00:04:19 -0700
Is it OK to perform a fetch during validateForInsert:/
validateForUpdate:? I have a Core Data entity named 'Person' with an
attribute named 'uniqueNumber'. I want to ensure that no two People
have the same uniqueNumber.
It's not a great idea during validateForDelete: It fine during
validateForInsert or validateForUpdate so long as the awakeFromFetch
delegates and any other side effects (changes on the MOC or dirtying
MOs) of fetching eventually reach a quiescent state. The canonical
example of failing to do so is to update a timestamp in -willSave to
the current time. Blindly. Without checking if it's already set, or
equal. We'll save when the current time stops changing ...
- Ben
_______________________________________________
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