• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
      • From: email@hidden
  • Prev by Date: NSSound needs a run loop cycle to repeat-play a sound?
  • Next by Date: Is there any ordered list or balanced tree
  • Previous by thread: Re: NSSound needs a run loop cycle to repeat-play a sound?
  • Next by thread: re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
  • Index(es):
    • Date
    • Thread